Repository navigation
fix: escape field IDs in hotkey scopes - #161
Open
feritcemkahraman wants to merge 2 commits into
Open
feritcemkahraman wants to merge 2 commits into
feritcemkahraman wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Approval should wait until Firefox/WebKit and any older-browser compatibility requirements for the new runtime dependency on CSS.escape are confirmed, since validation currently covers only Chromium and the supported browser baseline is unspecified.
No open issues 🎉
What changed in this PR
This pull request fixes scoped hotkeys for form fields whose IDs contain quotes or backslashes by safely escaping those IDs in CSS selectors.
Changes:
- Escape field IDs with
CSS.escapewhen constructing scope selectors. - Add parameterized Chromium regression tests for quoted and backslash-containing IDs.
| File | Description |
|---|---|
test/test.js |
Adds regression tests for IDs containing quotes and backslashes. |
src/index.ts |
Escapes form-field IDs before using them in scoped hotkey selectors. |
Review effort: Lite (auto)
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Scoped hotkeys fail when a form field ID contains a quote or backslash: quotes can throw a selector error and backslashes change the match.
Escape IDs for CSS selectors, and fall back to comparing scope attributes directly when CSS.escape is unavailable. The fallback scans scoped elements only in that older-browser case.
Validation: the missing-CSS.escape regression failed before the fallback and passed afterward. The 75-test browser suite passed in Chromium, Firefox and WebKit; ESLint and TypeScript checks passed. Earlier, all 102 tests passed in each engine on the previous head. Cached Playwright browsers were run with one worker. No actual legacy browser was tested.
Codex assisted with implementation and testing.