File tree Expand file tree Collapse file tree 5 files changed +10
-13
lines changed
Expand file tree Collapse file tree 5 files changed +10
-13
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @patternfly/elements " : patch
3+ ---
4+ ` <pf-tabs> ` : improved accessibility for elements extending ` BaseTab ` and
5+ ` BaseTabPanel ` by assigning random IDs when no exists.
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { LitElement, html } from 'lit';
44import { queryAssignedElements } from 'lit/decorators/query-assigned-elements.js' ;
55import { query } from 'lit/decorators/query.js' ;
66
7+ import { getRandomId } from '@patternfly/pfe-core/functions/random.js' ;
78import { ComposedEvent } from '@patternfly/pfe-core' ;
89
910import style from './BaseTab.css' ;
@@ -37,6 +38,7 @@ export abstract class BaseTab extends LitElement {
3738
3839 connectedCallback ( ) {
3940 super . connectedCallback ( ) ;
41+ this . id ||= getRandomId ( this . localName ) ;
4042 this . addEventListener ( 'click' , this . #clickHandler) ;
4143 this . #internals. role = 'tab' ;
4244 }
Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ import { LitElement, html } from 'lit';
22
33import style from './BaseTabPanel.css' ;
44
5+ import { getRandomId } from '@patternfly/pfe-core/functions/random.js' ;
6+
57export abstract class BaseTabPanel extends LitElement {
68 static readonly styles = [ style ] ;
79
@@ -17,6 +19,7 @@ export abstract class BaseTabPanel extends LitElement {
1719
1820 connectedCallback ( ) {
1921 super . connectedCallback ( ) ;
22+ this . id ||= getRandomId ( 'pf-tab-panel' ) ;
2023 this . #internals. role = 'tabpanel' ;
2124 /*
2225 To make it easy for screen reader users to navigate from a tab
Original file line number Diff line number Diff line change 11import { customElement } from 'lit/decorators/custom-element.js' ;
22
3- import { getRandomId } from '@patternfly/pfe-core/functions/random.js' ;
4-
53import styles from './pf-tab-panel.css' ;
64
75import { BaseTabPanel } from './BaseTabPanel.js' ;
@@ -16,11 +14,6 @@ import { BaseTabPanel } from './BaseTabPanel.js';
1614@customElement ( 'pf-tab-panel' )
1715export class PfTabPanel extends BaseTabPanel {
1816 static readonly styles = [ ...BaseTabPanel . styles , styles ] ;
19-
20- connectedCallback ( ) {
21- super . connectedCallback ( ) ;
22- this . id ||= getRandomId ( 'pf-tab-panel' ) ;
23- }
2417}
2518
2619declare global {
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ import { customElement } from 'lit/decorators/custom-element.js';
22import { property } from 'lit/decorators/property.js' ;
33
44import { observed } from '@patternfly/pfe-core/decorators.js' ;
5- import { getRandomId } from '@patternfly/pfe-core/functions/random.js' ;
65
76import { BaseTab } from './BaseTab.js' ;
87
@@ -77,11 +76,6 @@ export class PfTab extends BaseTab {
7776
7877 @observed
7978 @property ( { reflect : true , type : Boolean } ) disabled = false ;
80-
81- connectedCallback ( ) {
82- super . connectedCallback ( ) ;
83- this . id ||= getRandomId ( 'pf-tab' ) ;
84- }
8579}
8680
8781declare global {
You can’t perform that action at this time.
0 commit comments