From cbc4b683def34b848cafe4600469b1ef5be9a4a9 Mon Sep 17 00:00:00 2001 From: Nick Milton Date: Wed, 8 May 2024 16:03:57 -0400 Subject: [PATCH] docs(api): correct information about how ids are generated --- docs/api/base-menu-toggle.md | 6 +++--- src/_baseMenuToggle.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/api/base-menu-toggle.md b/docs/api/base-menu-toggle.md index de301d3..6789a28 100644 --- a/docs/api/base-menu-toggle.md +++ b/docs/api/base-menu-toggle.md @@ -189,10 +189,10 @@ BaseMenuToggle._setIds(); If the toggle and controlled menu do not have IDs, the following steps take place: -- Generate a random 10 character string, +- Generate a random string 1-10 characters long, - Get the innerText of the toggle, -- Set the toggle's ID to: `${toggle-inner-text}-${the-random-string}-menu-button` -- Set the menu's ID to: `${toggle-inner-text}-${the-random-string}-menu` +- Set the toggle's ID to: `menu-button-${toggle-inner-text}-${the-random-string}` +- Set the menu's ID to: `menu-${toggle-inner-text}-${the-random-string}` ### _setAriaAttributes {#method--setAriaAttributes} diff --git a/src/_baseMenuToggle.js b/src/_baseMenuToggle.js index fb1e986..6db884d 100644 --- a/src/_baseMenuToggle.js +++ b/src/_baseMenuToggle.js @@ -172,10 +172,10 @@ class BaseMenuToggle { * Sets unique IDs for the toggle and controlled menu. * * If the toggle and controlled menu do not have IDs, the following steps take place: - * - Generate a random 10 character string, + * - Generate a random string 1-10 characters long, * - Get the innerText of the toggle, - * - Set the toggle's ID to: `${toggle-inner-text}-${the-random-string}-menu-button` - * - Set the menu's ID to: `${toggle-inner-text}-${the-random-string}-menu` + * - Set the toggle's ID to: `menu-button-${toggle-inner-text}-${the-random-string}` + * - Set the menu's ID to: `menu-${toggle-inner-text}-${the-random-string}` * * @protected */