Page MenuHomePhabricator

[Chrome] On mobile web, links to sections whose names include double quote " work incorrectly
Closed, ResolvedPublic

Description

To reproduce, In an incognito window try these links on a mobile device running chrome with a small screen (not a desktop or a tablet):

  1. https://en.wikipedia.org/wiki/User:Amire80/Sections_test#Two
  2. https://en.wikipedia.org/wiki/User:Amire80/Sections_test#%22Three%22

The first link (Two) works as expected: the page is opened, and the section is expanded.

The second link ("Three") should work the same, it opens the page, but doesn't expand any sections. I'd expect it to open the section, just like with the other link.

Developer notes

Confirmed. There's some code in JS that handles this, that's not executing correctly.
Possibly related: T209418

Works fine on Safari and Firefox.

Works fine for: https://en.m.wikipedia.org/wiki/User:Amire80/Sections_test#.22Three.22

The issue is Toggler.prototype.reveal
It calls
$target = $container.find( escapeHash( selector ) );

In this case this essentially boils down to $('#"Three"') which is an invalid Sizzle selector. Our code catches this silently so we were apparently aware of this possibility.
When a quote is present we need to map this to `$('[id="\\"Three\\""]')

The use of quotes in IDs should likely be discouraged given the workarounds needed. Instead of the MobileFrontend fix we may want to disallow quotes in generated IDs. If we decide to take this route decline this bug and open up a new task requesting that.

Proposed MobileFrontend fix

  • Add a method for the edge case to Toggler.js and add tests

Event Timeline

Jdlrobson subscribed.

I believe this is a duplicate of T238385 and should be fixed now.

Can you confirm?

I believe this is a duplicate of T238385 and should be fixed now.

Can you confirm?

Just tried it - still not working :( moving to needs analysis

Jdlrobson renamed this task from On mobile web, links to sections whose names include double quote " work incorrectly to [Chrome] On mobile web, links to sections whose names include double quote " work incorrectly.Apr 1 2020, 3:21 PM
Jdlrobson updated the task description. (Show Details)

This appears to work fine in Firefox. Possible Chrome bug?

The link seems to be generated by table of contents so marking as a mediawiki interface concern

@Bawolff you recently touched this code on T238385 so I'm wondering if you might know what's happening here.

Jdlrobson lowered the priority of this task from Medium to Low.May 1 2020, 3:22 PM
Jdlrobson updated the task description. (Show Details)

(I explained the fix in the developer notes - it's pretty straight forward but also an edge case)

Aklapper added a subscriber: ovasileva.

Removing task assignee due to inactivity, as this open task has been assigned for more than two years. See the email sent to the task assignee on February 06th 2022 (and T295729).

Please assign this task to yourself again if you still realistically [plan to] work on this task - it would be welcome.

If this task has been resolved in the meantime, or should not be worked on ("declined"), please update its task status via "Add Action… 🡒 Change Status".

Also see https://www.mediawiki.org/wiki/Bug_management/Assignee_cleanup for tips how to best manage your individual work in Phabricator.

Change 791464 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/MobileFrontend@master] Toggler: Fix revealing sections with special characters like `"` `,` `(`

https://gerrit.wikimedia.org/r/791464

matmarex subscribed.

We ran into the same issue with links to comments used by DiscussionTools (T301932).

Change 791464 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] Toggler: Fix revealing sections with special characters like `"` `,` `(`

https://gerrit.wikimedia.org/r/791464

(Assuming editing will be doing QA here - let me know if that's not the case)