Repository navigation
feat(button): add focusVisible to show the focused state - #18030
onlyexeption wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block approval of the button focus-state and shared Combo add-item changes.
No open issues 🎉
What changed in this PR
Adds focusVisible to igxButton and igxIconButton and centralizes the Combo “Add item” button, addressing #18023 without external focus-class bindings.
Changes:
- Combines the new
focusVisibleinput with each button’s own keyboard-focus state. - Moves default and custom add-item rendering into
IgxComboAddItemComponent, shared by Combo and Simple Combo. - Adds focus-state and runtime template-switching tests, plus API documentation and release notes.
| File | Description |
|---|---|
| projects/igniteui-angular/simple-combo/src/simple-combo/simple-combo.component.ts | Removes button and ripple imports now owned by the add-item component. |
| projects/igniteui-angular/simple-combo/src/simple-combo/simple-combo.component.html | Passes the template and label instead of duplicating button markup. |
| projects/igniteui-angular/directives/src/directives/button/README.md | Documents focusVisible for buttons and icon buttons. |
| projects/igniteui-angular/directives/src/directives/button/icon-button.directive.spec.ts | Tests enabling and clearing the icon button’s focus state. |
| projects/igniteui-angular/directives/src/directives/button/button.directive.spec.ts | Tests explicit focus state, keyboard focus, and pointer interaction. |
| projects/igniteui-angular/directives/src/directives/button/button-base.ts | Adds focusVisible and combines it with keyboard focus. |
| projects/igniteui-angular/combo/src/combo/combo.component.ts | Removes button and ripple imports now owned by the add-item component. |
| projects/igniteui-angular/combo/src/combo/combo.component.spec.ts | Tests switching between default and custom add-item templates at runtime. |
| projects/igniteui-angular/combo/src/combo/combo.component.html | Delegates add-item rendering through template and label inputs. |
| projects/igniteui-angular/combo/src/combo/combo-add-item.component.ts | Owns rendering inputs and preserves custom-template focus styling. |
| projects/igniteui-angular/combo/src/combo/combo-add-item.component.html | Provides shared add-item markup using focusVisible. |
| CHANGELOG.md | Announces the new button input. |
Review effort: Balanced
IMinchev64
left a comment
There was a problem hiding this comment.
Heads up: since this targets ibarakov/fix-17992 instead of master, the CI checks don't run here, so this isn't visible on the PR. npm run build:lib fails:
combo.component.html:122:42 - error TS2322: Type 'string | undefined' is not assignable to type 'string'.
resourceStrings.igx_combo_addCustomValues_placeholder is string | undefined (all resource string keys are optional), but the new label input is typed string. Same thing in simple-combo.component.html:118. Typing it as label: string | undefined = '' (or adding ?? '' in both templates) should fix it.
|
@IMinchev64 I changed this to a stacked PR. I think that was the intention. |
Closes #18023
Description
IgxComboAddItemComponentnow renders the default "Add item" button from its own template (combo-add-item.component.html). The combos pass it[template](the customigxComboAddItemtemplate) and[label]instead of thecustomTemplateflag.igx-button--focusedfrom outside.focusVisibleinput onigxButton/igxIconButton. It shows the focused state while focus is on another element (e.g. a list usingaria-activedescendant), combined with the button's own keyboard focus. The add item binds[focusVisible]="active", so the|| undefinedworkaround is gone.Motivation / Context
Follow-up from the #18019 review: the default button was copy-pasted in both combos, and its focus class was set from outside with a fragile
|| undefinedbinding. Builds on #18019, so its commits show here until it merges.Type of Change (check all that apply):
Component(s) / Area(s) Affected:
Combo, Simple Combo, Button (
igxButton,igxIconButton)How Has This Been Tested?
New specs:
focusVisibleonigxButton(set/unset, own keyboard focus, pointerdown) andigxIconButton, plus switchingaddItemTemplateat runtime. All existing add item specs pass unchanged (513 tests across combo, simple combo, drop-down, button and button-group). A temporary before/after comparison found the add item's DOM, classes and computed styles identical in every focus state, and Enter/click, ripple and custom-template behavior unchanged.Test Configuration:
Screenshots / Recordings
None, no visual change.
Checklist:
feature/README.MDupdates for the feature docsREADME.MDCHANGELOG.MDupdates for newly added functionalityng updatemigrations for the breaking changes (migrations guidelines)