-
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
[EuiCodeBlock] Add new lineNumbers.annotations
API
#6580
Conversation
- reusable component specific to EuiCodeBlock only (including icon) + tweak code block line styles to accommodate new annotation icons
- via a custom `type: annotation` object - making the annotation button an accessible child of the `lineNumber` element requires removing the `aria-hidden` from the wrapper, and creating a new child that has `aria-hidden` on it (hence the new lineNumberWrapper stlyes and snapshot markup changes) - TBD: figuring out accessible line number + highlight announcements would be great, but is out of scope for this PR
- ensuring that virtualized and fullscreen annotations are both tested, since there isn't an example of that currently in our docs + fix fun bug found during E2E tests where Escape keypresses would also close fullscreen - TDD works!
@miukimiu Do you mind updating the Figma library with this new design/functionality, and of course providing any UI/UX feedback or change requests for this PR? @glitteringkatie If you have the time, a quick engineering code review would be appreciated! Doesn't need to be super in-depth as I went very very extra on writing tests for this functionality, but figured you might be interested 👀 |
Preview documentation changes for this PR: https://eui.elastic.co/pr_6580/ |
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.
Thanks @cee-chen,
I tested in Chrome, Safari, Edge, and Firefox. I tested using the keyboard navigation and mouse.
I pushed 1da9d83 to improve the icon color contrast in dark mode:
I also added motion on hover and focus. I used the same animation that we have on other buttons:
From a design perspective LGTM! 🎉
Let me know if the changes sound good.
Preview documentation changes for this PR: https://eui.elastic.co/pr_6580/ |
Absolutely lovely changes! Thank you Elizabet! I'm going to go ahead and merge - if you could check off the Figma checklist item whenever you've added this to the Figma library (if applicable) that would be super helpful. Katie, feel free to leave any comments or code review still - I can always open a follow-up PR if you notice anything! |
} | ||
css={styles.euiCodeBlockAnnotation} | ||
zIndex={Number(euiTheme.levels.mask) + 1} // Ensure fullscreen annotation popovers sit above the mask | ||
anchorPosition="leftCenter" |
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.
Thank you for this component!
Literally only comment is a nit:
We'd prefer this to be downLeft
. There isn't necessarily a lot of space to the left of code blocks and then it defaults to rightCenter
and covers up the code snippet it is annotating. I guess you could make the same argument for multi-line annotations but I think the more common case is one line so we'd rather optimize for that.
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.
I'm totally good with that! Do you want to make a super quick PR with that change? 🙌
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.
Will do!
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.
#6600 🎉
## Summary `eui@75.0.0` ⏩ `eui@75.1.0` --- ## [`75.1.0`](https://github.com/elastic/eui/tree/v75.1.0) - Added padding to `EuiStep` title to better align with icon ([#6555](elastic/eui#6555)) - Added a new `lineNumbers.annotations` API to `EuiCodeBlock`. This new feature displays an informational icon next to the specified line number(s), providing more context via popover ([#6580](elastic/eui#6580)) **Bug fixes** - Fixed bug in `EuiRange` where styles were applied incorrectly when custom ticks were passed but `showTicks` were false ([#6588](elastic/eui#6588)) - Fixed `fleetApp` and `agentApp` icons that were swapped ([#6590](elastic/eui#6590)) **CSS-in-JS conversions** - Converted `EuiSteps` to Emotion; Removed `$euiStepStatusColorsToFade`, `$euiStepNumberSize`, `$euiStepNumberSmallSize`, and `$euiStepNumberMargin` ([#6555](elastic/eui#6555))
Summary
closes #6564
This PR implements a new
annotations
API for EuiCodeBlock, with the primary purpose of aiding the @elastic/docs-engineering team and new Elastic docs efforts.Example usage:
QA
QA link: https://eui.elastic.co/pr_6580/#/editors-syntax/code#line-numbers
General checklist
@default
if default values are missing) and playground toggles- [ ] Checked Code Sandbox works for any docs examples- [ ] Checked for breaking changes and labeled appropriately