File tree Expand file tree Collapse file tree 4 files changed +9
-4
lines changed
core/pfe-core/controllers Expand file tree Collapse file tree 4 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @patternfly/elements " : patch
3+ ---
4+ ` <pf-tabs> ` : improved screen-reader accessibility
Original file line number Diff line number Diff line change @@ -92,8 +92,10 @@ export class TabsAriaController<
9292 for ( const child of this . #element. children ) {
9393 if ( this . #options. isTab ( child ) ) {
9494 tabs . push ( child ) ;
95+ child . role ??= 'tab' ;
9596 } else if ( this . #options. isPanel ( child ) ) {
9697 panels . push ( child ) ;
98+ child . role ??= 'tabpanel' ;
9799 }
98100 }
99101 if ( tabs . length > panels . length ) {
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { state } from 'lit/decorators/state.js';
44import { consume } from '@lit/context' ;
55
66import { getRandomId } from '@patternfly/pfe-core/functions/random.js' ;
7+
78import { type PfTabsContext , context } from './context.js' ;
89
910import styles from './pf-tab-panel.css' ;
@@ -19,8 +20,6 @@ import styles from './pf-tab-panel.css';
1920export class PfTabPanel extends LitElement {
2021 static readonly styles = [ styles ] ;
2122
22- #internals = this . attachInternals ( ) ;
23-
2423 @consume ( { context, subscribe : true } )
2524 @state ( ) private ctx ?: PfTabsContext ;
2625
@@ -34,7 +33,6 @@ export class PfTabPanel extends LitElement {
3433 super . connectedCallback ( ) ;
3534 this . id ||= getRandomId ( 'pf-tab-panel' ) ;
3635 this . hidden ??= true ;
37- this . #internals. role = 'tabpanel' ;
3836
3937 /*
4038 To make it easy for screen reader users to navigate from a tab
Original file line number Diff line number Diff line change @@ -234,7 +234,8 @@ export class PfTabs extends LitElement {
234234 }
235235
236236 #onExpand( event : Event ) {
237- if ( event instanceof TabExpandEvent && ! event . defaultPrevented ) {
237+ if ( event instanceof TabExpandEvent &&
238+ ! event . defaultPrevented && this . tabs . includes ( event . tab ) ) {
238239 this . select ( event . tab ) ;
239240 }
240241 }
You can’t perform that action at this time.
0 commit comments