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-itemslot - 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 |
|---|---|
|
|
How to set up and validate locally
- Create an MR with changes
- Enable the
rapid_diffs_on_mr_showfeature flag ->rails c->Feature.enable(:rapid_diffs_on_mr_show) - Visit your MR's Changes tab and add
?rapid_diffs=trueto the URL - 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.

