fix(button): block clicks and ENTER/SPACE on disabled anchor hosts (#DS-4364)#1630
fix(button): block clicks and ENTER/SPACE on disabled anchor hosts (#DS-4364)#1630lskramarov wants to merge 7 commits into
Conversation
|
Visit the preview URL for this PR (updated for commit 2e8264d): https://koobiq-next--prs-1630-6vtwb8ip.web.app (expires Sat, 20 Jun 2026 15:57:22 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: c9e37e518febda70d0317d07e8ceb35ac43c534c |
🚨 E2E tests failedReview the report for details. 💡 Comment |
🚨 E2E tests failedReview the report for details. 💡 Comment |
|
/approve-snapshots |
|
🔄 Updating snapshots. |
|
✅ Snapshots updated! |
…et aria-disabled (#DS-4364)
…DS-4364) - extend the disabled keydown guard to DOWN/LEFT/RIGHT arrows, not just ENTER/SPACE, since KbqDropdownTrigger also opens on those (Tab/Escape left untouched so focus can still leave a disabled but focusable <a kbq-button> host); fix the misleading comment - dedupe the COMMENT_NODE literal by reusing getNodesWithoutComments at both levels - tests: assert a disabled dropdown trigger stays closed on click/ENTER/SPACE/arrow (guards stopImmediatePropagation), the effect()-driven reveal while the content observer is disabled, aria-disabled removal on re-enable, parentTextElement wrapping textElement, and the dev-mode warning when the styler is used without KbqButton
# Conflicts: # packages/components/sidepanel/__screenshots__/03-light.png
🚨 E2E tests failedReview the report for details. 💡 Comment |
|
/approve-snapshots |
|
🔄 Updating snapshots. |
|
✅ Snapshots updated! |
There was a problem hiding this comment.
Pull request overview
This PR updates the KbqButton implementation to properly block user interaction on disabled anchor hosts (e.g. <a kbq-button disabled>), while also refining button content layout to support explicit left/right icon slots and reliable text truncation.
Changes:
- Block
clickand activation-relatedkeydownevents (ENTER/SPACE + relevant arrows) on disabled<a kbq-button>using capture-phase native listeners; addaria-disabledhandling. - Introduce
[kbqButtonLeftIcon]/[kbqButtonRightIcon]marker directives and update projection + styling logic to make icon placement order-independent. - Replace the previous overlay-based click interception and add a dedicated text container (
.kbq-button-text) with truncation styles.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tools/public_api_guard/components/button.api.md | Updates public API surface for new icon slot directives and refactors in KbqButton/KbqButtonCssStyler. |
| packages/docs-examples/components/button/button-content/button-content-example.ts | Adds an example demonstrating order-independent icon slots. |
| packages/components/filter-bar/_filter-bar-theme.scss | Removes styles targeting the removed .kbq-button-overlay. |
| packages/components/button/public-api.ts | Exports the new button-icon entrypoint. |
| packages/components/button/button.scss | Removes .kbq-button-overlay styling (overlay element removed). |
| packages/components/button/button.module.ts | Registers and exports the new left/right icon marker directives. |
| packages/components/button/button.component.ts | Implements capture-phase event blocking for disabled anchors; adds aria-disabled; refactors icon detection/styling and exposes title measurement elements. |
| packages/components/button/button.component.spec.ts | Adds coverage for disabled-anchor click/keyboard blocking, dropdown trigger behavior, and new icon slot + truncation-related behavior. |
| packages/components/button/button.component.html | Updates projection structure: left slot, text container, right slot; disables content observer when no icons. |
| packages/components/button/button-icon.ts | Adds [kbqButtonLeftIcon] / [kbqButtonRightIcon] marker directives. |
| packages/components/button/_button-theme.scss | Adjusts focus outline behavior to avoid showing keyboard focus on disabled (still-focus-retaining) anchors; removes overlay-related rules. |
| packages/components/button/_button-base.scss | Adds .kbq-button-text with truncation and flex alignment; ensures wrapper/text can shrink for ellipsis. |
| packages/components-dev/button/template.html | Adds dev showcase for icon slots and ellipsis behavior. |
| packages/components-dev/button/module.ts | Adds KbqTitleModule to support the new ellipsis demo usage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @Directive({ | ||
| selector: '[kbqButtonLeftIcon]' | ||
| }) | ||
| export class KbqButtonLeftIcon {} |
There was a problem hiding this comment.
может лучше именовать как в form-field - prefix и suffix, что при добавлении rtl не было путаницы
No description provided.