Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport PR #407 on branch 1.x (Fix labelledby to support multiple elements on page) #409

Merged
merged 1 commit into from
Sep 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/widgets/src/accordionpanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,10 @@ export namespace AccordionPanel {
* The default implementation of `IRenderer`.
*/
export class Renderer extends SplitPanel.Renderer implements IRenderer {
constructor() {
super();
this._uuid = ++Renderer._nInstance;
}
/**
* A selector which matches any title node in the accordion.
*/
Expand Down Expand Up @@ -430,12 +434,14 @@ export namespace AccordionPanel {
createTitleKey(data: Title<Widget>): string {
let key = this._titleKeys.get(data);
if (key === undefined) {
key = `title-key-${this._titleID++}`;
key = `title-key-${this._uuid}-${this._titleID++}`;
this._titleKeys.set(data, key);
}
return key;
}

private static _nInstance = 0;
private readonly _uuid: number;
private _titleID = 0;
private _titleKeys = new WeakMap<Title<Widget>, string>();
}
Expand Down
7 changes: 6 additions & 1 deletion packages/widgets/src/tabbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1553,6 +1553,9 @@ export namespace TabBar {
* Subclasses are free to reimplement rendering methods as needed.
*/
export class Renderer implements IRenderer<any> {
constructor() {
this._uuid = ++Renderer._nInstance;
}
/**
* A selector which matches the close icon node in a tab.
*/
Expand Down Expand Up @@ -1662,7 +1665,7 @@ export namespace TabBar {
createTabKey(data: IRenderData<any>): string {
let key = this._tabKeys.get(data.title);
if (key === undefined) {
key = `tab-key-${this._tabID++}`;
key = `tab-key-${this._uuid}-${this._tabID++}`;
this._tabKeys.set(data.title, key);
}
return key;
Expand Down Expand Up @@ -1747,6 +1750,8 @@ export namespace TabBar {
return extra ? `${name} ${extra}` : name;
}

private static _nInstance = 0;
private readonly _uuid: number;
private _tabID = 0;
private _tabKeys = new WeakMap<Title<any>, string>();
}
Expand Down