Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escape strings used in query selectors #5565

Merged
merged 1 commit into from Dec 13, 2023
Merged

Conversation

reidbarber
Copy link
Member

Escapes our strings used in query selectors. Keys may be strings that are invalid as selectors, so we want to avoid errors like: "Failed to execute 'querySelector' on 'Element': '[data-key="Apple""]' is not a valid selector."

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

Smoke test affected components.

🧢 Your Project:

Copy link
Member

@snowystinger snowystinger left a comment

Choose a reason for hiding this comment

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

Looks good.

At some point we should really write a test which can fuzz the inputs. We could use the same fast check which we used for NumberField. https://github.com/adobe/react-spectrum/blob/main/packages/%40internationalized/number/test/NumberParser.test.js#L168 and instead of round trips, we could just check for a couple basic interactions such as keyboard navigate and select.

@reidbarber reidbarber merged commit eb21e69 into main Dec 13, 2023
26 checks passed
@reidbarber reidbarber deleted the escape-selector-strings branch December 13, 2023 04:11
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.

None yet

3 participants