Problem/Motivation
When links in node previews are clicked, a modal is supposed to be presented to a user confirming that they want to navigate away from the preview. See #1440662: UX regression: Prevent links in node preview from being clicked for more details.
This behavior has apparently been broken since ef3674cc559358890e4cab01f1266503e2b16515, when jQuery was updated to 2.2.3 in April 2016!
Since we upgraded jQuery, any time any element in the node preview page is clicked, this error is thrown in the console:
Uncaught Error: Syntax error, unrecognized expression: [href^=#], #edit-backlink, #toolbar-administration a
This is happening because attribute selectors containing a hash have to quote the attribute value (ref https://github.com/jquery/jquery-migrate/issues/140). So [href^=#]
is invalid, but [href^="#"]
is OK.
Proposed resolution
Fix the bug by updating the selector, and write a Javascript test this time to prevent future regressions.
Remaining tasks
Write a failing test, then the simple fix.
User interface changes
None.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#4 | 2939885-4-test-only.patch | 1.89 KB | samuel.mortenson |
#4 | 2939885-4.patch | 3.71 KB | samuel.mortenson |
Comments
Comment #2
samuel.mortensonComment #3
xjmI think we actually treated this issue as a critical the last time around, so promoting accordingly. Lost user input is generally major per our definition at https://www.drupal.org/core/issue-priority#major-bug, but since this was "lost user input for the 80% usecase" it was serious enough to be considered a critical UX issue.
Comment #4
samuel.mortensonAttached a test-only and fix patch. I found three other bugs with the current file:
.content
selector was used, which is specific to classy. There's no harm in targeting the entire document (context).Comment #7
samuel.mortensonComment #8
timmillwoodLooks good to me, nice to have a test for this now!
Comment #10
catchCommitted 3b304d2 and pushed to 8.6.x. Thanks!