From 74169f853ae3420d58a2eb3b2cf08b73ad590575 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 10 Oct 2024 14:29:00 +0000 Subject: [PATCH 1/4] Create PR for #1415 From 0210f2494e2a306d331df948880e0f4da05b40a0 Mon Sep 17 00:00:00 2001 From: "Marinkov, Magdalena" Date: Thu, 10 Oct 2024 16:47:51 +0200 Subject: [PATCH 2/4] fix(a11y): add aria-haspop prop on buttons triggering a popup/popover --- .../core/src/components/bal-button/bal-button.interfaces.ts | 1 + packages/core/src/components/bal-button/bal-button.tsx | 2 ++ .../core/src/components/bal-popover/test/bal-popover.cy.html | 1 - 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/core/src/components/bal-button/bal-button.interfaces.ts b/packages/core/src/components/bal-button/bal-button.interfaces.ts index 68a63ccd17..3a0fa991e5 100644 --- a/packages/core/src/components/bal-button/bal-button.interfaces.ts +++ b/packages/core/src/components/bal-button/bal-button.interfaces.ts @@ -30,6 +30,7 @@ namespace BalProps { controls?: string title?: string label?: string + haspopup?: string } } diff --git a/packages/core/src/components/bal-button/bal-button.tsx b/packages/core/src/components/bal-button/bal-button.tsx index 4341dd0154..df01ef89d8 100644 --- a/packages/core/src/components/bal-button/bal-button.tsx +++ b/packages/core/src/components/bal-button/bal-button.tsx @@ -170,6 +170,7 @@ export class Button implements ComponentInterface { 'aria-controls', 'aria-hidden', 'tabindex', + 'aria-haspopup', ]) } @@ -284,6 +285,7 @@ export class Button implements ComponentInterface { 'aria-label': this.aria?.label || this.inheritAttributes['aria-label'] || this.aria?.title || this.inheritAttributes['title'], 'aria-controls': this.aria?.controls || this.inheritAttributes['aria-controls'], + 'aria-haspopup': this.aria?.haspopup || this.inheritAttributes['aria-haspopup'], } return ( diff --git a/packages/core/src/components/bal-popover/test/bal-popover.cy.html b/packages/core/src/components/bal-popover/test/bal-popover.cy.html index 97d20f389d..f7f57bbbf0 100644 --- a/packages/core/src/components/bal-popover/test/bal-popover.cy.html +++ b/packages/core/src/components/bal-popover/test/bal-popover.cy.html @@ -15,7 +15,6 @@ Date: Thu, 10 Oct 2024 16:49:36 +0200 Subject: [PATCH 3/4] fix(a11y): add aria-haspop prop on buttons triggering a popup/popover --- packages/core/src/components/bal-popover/bal-popover.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/core/src/components/bal-popover/bal-popover.tsx b/packages/core/src/components/bal-popover/bal-popover.tsx index 25d2e08277..96ccca78e9 100644 --- a/packages/core/src/components/bal-popover/bal-popover.tsx +++ b/packages/core/src/components/bal-popover/bal-popover.tsx @@ -398,6 +398,7 @@ export class Popover implements ComponentInterface, Loggable, BalBreakpointObser Date: Fri, 22 Nov 2024 12:17:57 +0100 Subject: [PATCH 4/4] fix(a11y): set aria-haspopup on button --- packages/core/src/components/bal-popover/bal-popover.tsx | 3 +-- packages/core/src/utils/attributes.ts | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/src/components/bal-popover/bal-popover.tsx b/packages/core/src/components/bal-popover/bal-popover.tsx index 96ccca78e9..d6c0417efd 100644 --- a/packages/core/src/components/bal-popover/bal-popover.tsx +++ b/packages/core/src/components/bal-popover/bal-popover.tsx @@ -150,11 +150,11 @@ export class Popover implements ComponentInterface, Loggable, BalBreakpointObser componentWillLoad() { this.backdropHeight = this.getBackdropHeight() + this.triggerElement.setAttribute('aria-haspopup', 'true') } componentDidLoad() { this.isInMainNav = this.footMobileNav !== null - if (this.triggerElement && this.menuElement) { this.popperInstance = createPopper(this.triggerElement, this.menuElement, { placement: this.tooltip ? 'bottom' : this.position, @@ -398,7 +398,6 @@ export class Popover implements ComponentInterface, Loggable, BalBreakpointObser