Skip to content

refactor(aria/combobox): forward advanced combination keys in SimpleComboboxPattern#33196

Merged
tjshiu merged 3 commits intoangular:mainfrom
tjshiu:keys
May 4, 2026
Merged

refactor(aria/combobox): forward advanced combination keys in SimpleComboboxPattern#33196
tjshiu merged 3 commits intoangular:mainfrom
tjshiu:keys

Conversation

@tjshiu
Copy link
Copy Markdown
Contributor

@tjshiu tjshiu commented May 4, 2026

Implements keyboard event forwarding for multi-selection combinations within SimpleComboboxPattern to fulfill requirements in components#33101.

  • Always relays Shift + ArrowUp and Shift + ArrowDown range selection events for all combobox types (including editable inputs).
  • Relays text-selection combo keys (Ctrl/Cmd + A, Shift + Home/End) exclusively for non-editable (select-only) comboboxes to prevent interference with browser-native input field text manipulation per W3C APG specs.

.on('ArrowUp', e => this.keyboardEventRelay.set(e), {ignoreRepeat: false})
.on('ArrowDown', e => this.keyboardEventRelay.set(e), {ignoreRepeat: false})
.on(Modifier.Shift, 'ArrowUp', e => this.keyboardEventRelay.set(e), {ignoreRepeat: false})
.on(Modifier.Shift, 'ArrowDown', e => this.keyboardEventRelay.set(e), {ignoreRepeat: false})
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am a bit curious about how to use it in a real example, when multiple options are selected, how will the input box change. Do we want to ship along with an example in dev-app?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also it'd be nice to see if other Aria directives handle the key combo automatically. E.g. listbox, tree, grid, etc.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Can you expand on what you mean for tree and grid ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just want to see examples of how multi-selectable works for Tree and Grid when used in Combobox with the combo keys.

@tjshiu tjshiu added the dev-app preview When applied, previews of the dev-app are deployed to Firebase label May 4, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

Deployed dev-app for b675d7f to: https://ng-dev-previews-comp--pr-angular-components-33196-dev-6vg7up43.web.app

Note: As new commits are pushed to this pull request, this link is updated after the preview is rebuilt.

@angular-robot angular-robot Bot added the area: docs Related to the documentation label May 4, 2026
@tjshiu
Copy link
Copy Markdown
Contributor Author

tjshiu commented May 4, 2026

I added another component - I wasn't sure which ones you wanted to test but there are two multi-select options now.

one previously with the select-only and now one with a dialog. That also sorta addresses this issue: #32659

@ok7sai
Copy link
Copy Markdown
Member

ok7sai commented May 4, 2026

Somehow I can't access the simple combobox and autocomplete pages in the preview dep-app.

tjshiu added 2 commits May 4, 2026 12:40
…omboboxPattern

Implements keyboard event forwarding for multi-selection combinations
within `SimpleComboboxPattern` to fulfill requirements in components#33101.
- Always relays `Shift + ArrowUp` and `Shift + ArrowDown` range selection events for all combobox types (including editable inputs).
- Relays text-selection combo keys (`Ctrl/Cmd + A`, `Shift + Home/End`) exclusively for non-editable (select-only) comboboxes to prevent interference with browser-native input field text manipulation per W3C APG specs.
- Extends `simple-combobox.spec.ts` with multi-key verification tests.
Introduces a new example component `SimpleComboboxMultiselectDialogExample`
demonstrating the definitive pattern for a multiselectable combobox
using a nested dialog layout with an inner search filter input.
@tjshiu
Copy link
Copy Markdown
Contributor Author

tjshiu commented May 4, 2026

I think the link works now - sometimes it take a while. so far now I just have listbox examples. But would it be okay to add the tree ones and grid ones in a following one ?

@ok7sai
Copy link
Copy Markdown
Member

ok7sai commented May 4, 2026

Yea those are definitely not the blockers. The changes don't affect the current usage so we are good.

@ok7sai
Copy link
Copy Markdown
Member

ok7sai commented May 4, 2026

Examples look good! The select all in Combobox select is really useful IMO. However I do find the shift + up/down select a bit wonky. Here's the step you can test it use the Combobox select as an example

  1. Open the select popup
  2. Use shift + down arrow key to select the first and second options ("Important" and "Starred").
  3. Use down arrow key move focus to "To Do".
  4. Try to use shift + up arrow key to select both "To Do" and "Personal".

Expected: "Important", "Starred", "Personal", and "To Do" are selected, and "Work" remain unselected.

Actual: "Important", "Starred", "Work", and "Personal" are selected. The selection anchor seems to stay on the "Important" when the arrow keys supposed to move the selection anchor along with the active item.

@tjshiu
Copy link
Copy Markdown
Contributor Author

tjshiu commented May 4, 2026

Nice catch - updated it so that it works for this case now - needed to reset the anchor point

@tjshiu
Copy link
Copy Markdown
Contributor Author

tjshiu commented May 4, 2026

Also this will be good for this issue: #33101

@ok7sai
Copy link
Copy Markdown
Member

ok7sai commented May 4, 2026

I see. Interesting because it works with the standalone Listbox multi-select example.

@ok7sai
Copy link
Copy Markdown
Member

ok7sai commented May 4, 2026

Also this will be good for this issue: #33101

Nice! Worth mention that we can't support ctrl/cmd + a for editable combobox because it's used for text selection.

@tjshiu tjshiu added action: merge The PR is ready for merge by the caretaker target: major This PR is targeted for the next major release labels May 4, 2026
@tjshiu tjshiu merged commit a08f1cb into angular:main May 4, 2026
33 checks passed
@tjshiu
Copy link
Copy Markdown
Contributor Author

tjshiu commented May 4, 2026

This PR was merged into the repository. The changes were merged into the following branches:

@tjshiu tjshiu deleted the keys branch May 5, 2026 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: aria/combobox area: aria/listbox area: docs Related to the documentation dev-app preview When applied, previews of the dev-app are deployed to Firebase target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants