[go: up one dir, main page]

Add component to manually override the disclosure item slot

What does this MR do and why?

For #572146 (closed)

  • Adds a component to provide arbitrary HTML to the GlDisclosureDropdownItem's #list-item slot
  • Wraps the diff file SHA in <code> on the back end
  • Switches from using the standard "items"/plain text interface to using the new component so we can render the <code> element

Caveats

Unfortunately, the GlDisclosureDropdownItem STILL limits us by placing this slot inside a <span>, so no consumer can properly display any arbitrary HTML (like a completely custom item with block elements, etc.). For now, we only need inline elements (like <code>), but this limitation is likely to affect DisclosureDropdown consumers in the future, and there's simply no way around it without refactoring the ...Item component to be more flexible (or completely re-implementing the default <slot> that wraps the link/button component, obviating the need for the GlDisclosureDropdownItem entirely).

Screenshots or screen recordings

Before After
image image

How to set up and validate locally

  1. Create an MR with changes
  2. Enable the rapid_diffs_on_mr_show feature flag -> rails c -> Feature.enable(:rapid_diffs_on_mr_show)
  3. Visit your MR's Changes tab and add ?rapid_diffs=true to the URL
  4. Open the 3-dots/kebab menu on a file

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Thomas Randolph

Merge request reports

Loading