[PR #8414] fix: escape data-key values for querySelector compatibility #12735

Closed
opened 2026-02-16 18:17:37 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/8414

State: closed
Merged: No


What does this PR do?

Fix #7408 #7670

Fixes a critical syntax error in the List component when using querySelector with data-key attributes containing special characters, spaces, quotes, or non-ASCII characters (like Chinese). The issue occurred because raw key values were being inserted directly into CSS selector strings without proper escaping.

How did you verify your code works?

  1. Added comprehensive unit tests: Created list.test.tsx with test cases covering:
    • File names with spaces
    • File names with single quotes
    • File names with special symbols (#, @, $, ^, &)
    • Non-ASCII Chinese file names
  2. Manual testing: Verified component functionality with various edge case key values
  3. Type safety: Ensured TypeScript compatibility with CSS.escape() usage
  4. Regression testing: Confirmed existing List component behavior remains unchanged
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/8414 **State:** closed **Merged:** No --- ### What does this PR do? Fix #7408 #7670 Fixes a critical syntax error in the List component when using querySelector with data-key attributes containing special characters, spaces, quotes, or non-ASCII characters (like Chinese). The issue occurred because raw key values were being inserted directly into CSS selector strings without proper escaping. ### How did you verify your code works? 1. **Added comprehensive unit tests**: Created `list.test.tsx` with test cases covering: - File names with spaces - File names with single quotes - File names with special symbols (#, @, $, ^, &) - Non-ASCII Chinese file names 2. **Manual testing**: Verified component functionality with various edge case key values 3. **Type safety**: Ensured TypeScript compatibility with CSS.escape() usage 4. **Regression testing**: Confirmed existing List component behavior remains unchanged
yindo added the pull-request label 2026-02-16 18:17:37 -05:00
yindo closed this issue 2026-02-16 18:17:38 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12735