-
Notifications
You must be signed in to change notification settings - Fork 840
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
[Docs] Replace Static HTML Element IDs Generated IDs (Layout Section) #5220
[Docs] Replace Static HTML Element IDs Generated IDs (Layout Section) #5220
Conversation
…Ds generated the htmlIdGenerator utility function
…l-htmlIdGenerator_docs Merging in the latest code from Master
…Ds generated the useGeneratedHtmlId utility function
…eehall/eui into breehall-htmlIdGenerator_docs Merging in the lastest code from the Master branch.
…generated the useGeneratedHtmlId utility function
…generated the useGeneratedHtmlId utility function
…generated the useGeneratedHtmlId utility function
…l-htmlIdGenerator_docs Merging in the latest code from the Master branch
…generated the useGeneratedHtmlId utility function
…enerated the useGeneratedHtmlId utility function
…l-htmlIdGenerator_docs Merging in the latest code from the Master branch
…l-htmlIdGenerator_docs Merging in the latest code from teh Master branch
… use the useGeneratedHtmlId utility function
…l-htmlIdGenerator_docs Merging in the latest code from Master
… use the useGeneratedHtmlId utility function
Preview documentation changes for this PR: https://eui.elastic.co/pr_5220/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5220/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing to note, is that at some point we should really be combining all these imports to point directly to src
instead of src/services
or src/components
because they end up as separate @elastic/eui
import lines.
Question:
When should we determine whether to use the new hook or old ()()
version? For example the loading state example has a button toggle that still uses htmlIdGenerator()()
?
I Checked:
- Accordions
- Can you update the snippets that contain multiple accordions in the same snippet in them to also contain unique
id
s? Like this example uses the same constant name in both accordions, but it should probably just beaccordionId1
andaccordionId2
. If they're separate snippets its ok to no be unique.
- Can you update the snippets that contain multiple accordions in the same snippet in them to also contain unique
- Flyout
- Header
- Popover
- Modal
- Resizable panel
src-docs/src/views/resizable_container/resizable_container_reset_values.js
Outdated
Show resolved
Hide resolved
…et_values.js Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
Preview documentation changes for this PR: https://eui.elastic.co/pr_5220/ |
I agree. It looks like we have an open issue for this ( Issue #5104 ), so we can tackle it soon.
I determined it based on the rule of hooks. Since |
👍 😄
🤦♀️ I totally missed this (that it wasn't created inside the component). Makes sense to keep it outside then just for simplicity sake of this PR. |
Hey @breehall , Is there more feedback you need on this PR? I've got some updates I need to push to the Accordion component and I know the docs I touched will conflict with this PR, so it might be good to get this one in first. |
@cchaos I don't believe so. This PR includes your previous feedback, so it should be ok to merge. I just hesitated because I didn't see an official approval on this. But if it looks good, I'll get this one merged 😊 |
I think there was still one more suggestion I provided about the accordions examples:
|
Created unique IDs in the snapshots for the example components for accordions.
@cchaos Sorry about that! I thought I had handled it, but it looks like it's updated now. Good catch! |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5220/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! LGTM!
…elastic#5220) * Revised element IDs within the Accordion section of src/docs to use IDs generated the htmlIdGenerator utility function * Revised element IDs within the Accordion section of src/docs to use IDs generated the useGeneratedHtmlId utility function * Revised element IDs within the Flyout section of src/docs to use IDs generated the useGeneratedHtmlId utility function * Revised element IDs within the Header section of src/docs to use IDs generated the useGeneratedHtmlId utility function * Revised element IDs within the Header section of src/docs to use IDs generated the useGeneratedHtmlId utility function * Revised element IDs within the Header section of src/docs to use IDs generated the useGeneratedHtmlId utility function * Revised element IDs within the Modal section of src/docs to use IDs generated the useGeneratedHtmlId utility function * Test commit * Revised element IDs within the Resizable Panel section of src/docs to use the useGeneratedHtmlId utility function * Revised element IDs within the Resizable Panel section of src/docs to use the useGeneratedHtmlId utility function * Revisions from PR * Update src-docs/src/views/resizable_container/resizable_container_reset_values.js Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com> * Update accordion_example.js Created unique IDs in the snapshots for the example components for accordions. Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
Summary
Updates any static HTML element IDs inside of EUI documentation with IDs generated by the
useGeneratedHtmlId
utility hook andhtmlIdGenerator()()
utility function. This change is based on Issue #4774 where it was reported that including multiple copies of the same code snippet can cause duplicate ID errors. While static IDs were removed, the existing generated IDs were standardized across relevant files.Page-by-page review of the docs revealed that there are about 80 instances of HTML element IDs in the docs. Here is a document defining the pages and components affected by this change.
This PR is to handle generated ID changes within the Layout section of the docs
Before
After
Note
This started in PR 5114 and after team input, I'll be creating smaller PRs for each major section of the docs.
Checklist
Check against all themes for compatibility in both light and dark modesChecked in mobileChecked in Chrome, Safari, Edge, and FirefoxAdded or updated jest testsA changelog entry exists and is marked appropriately