Skip to content

fix: escape field IDs in hotkey scopes - #161

Open
feritcemkahraman wants to merge 2 commits into
github:mainfrom
feritcemkahraman:fix/escape-scoped-field-ids
Open

feritcemkahraman wants to merge 2 commits into
github:mainfrom
feritcemkahraman:fix/escape-scoped-field-ids

Conversation

@feritcemkahraman

@feritcemkahraman feritcemkahraman commented Oct 16, 2026 •

Copy link
Copy Markdown

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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.escape when 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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants