Skip to content

feat(elements): typed Slot_style for restricted slot constructors - #398

Merged
tiensonqin merged 12 commits into
mainfrom
devin/1795170280-dropdown-item-styling
Nov 20, 2026
Merged

tiensonqin merged 12 commits into
mainfrom
devin/1795170280-dropdown-item-styling

Conversation

@tiensonqin

@tiensonqin tiensonqin commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The restricted-slot changes (ADR 0007) made menu_card, dropdown_menu, menu_trigger and toolbar accept only slot types such as dropdown_menu_item_el, dropdown_menu_el and toolbar_el. Those builders exposed no typography, hover/focus, shadow or overflow styling. Logseq styles these elements through t -> t decorators, so after this change it could not compile without dropping that styling or getting around the slot types.

This PR adds one typed style value, Slot_style.t. It is accepted as a single optional ~style argument by the ordinary menu_item, dropdown_menu_item, the dropdown containers and toolbar controls/text. The restricted slot types are unchanged. The style maps onto wire properties these elements already support, so the wire protocol does not change.

let item_style =
  Slot_style.make ~font_weight:Medium ~hover_background:token ~focus_background:token ()

menu_trigger ~text:"More"
  (dropdown_menu ~style:(Slot_style.make ~shadow ~collision_padding:8 ())
     [dropdown_menu_item ~text:"Open" ~style:item_style ~on_press:open_ []])
  • Web: an authored hover/focus color wins on its own over the default highlight, and an authored focus background keeps the normal foreground color.
  • JSON buttons: JSON buttons, including toolbar buttons, apply the style's appearance properties.
  • Docs: docs/api-migrations.md lists which renderers draw each property. Apple native menu labels ignore typography, and Android menu rows ignore hover/focus.

Testing

  • Passing: web and tooling suites, keyboard data-highlighted coverage, exact muted-background assertions, and native core.
  • Failing in the strict native warning gate (Cocoa deprecations), the Apple aggregate run and the JSON generator's scroll_key exit. All three fail the same way on base 8b8c0f42.

Link to Devin session: https://app.devin.ai/sessions/5f265455dad249ecbf49d40db7f7a88a
Open in Devin Desktop: https://app.devin.ai/desktop/session/5f265455dad249ecbf49d40db7f7a88a?variant=devin
Requested by: @tiensonqin


🟢 Devin fixed all 2 findings · Follow Devin's work

Devin Review

@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Newer findings are available below. Devin Review posted a newer report on this PR, in addition to the findings presented here.

Devin Review found 5 findings. Devin automatically fixed all 5 findings.

Fixed by Devin (5)
  • Native menu styling limits are undocumented — Documented which renderers draw each prop.
  • Web defaults mask standalone menu colors — Each hover/focus override now wins on its own; tests cover each prop alone.
  • Focus test accepts an unpainted background — The test now asserts the exact muted color in light and dark.
  • Untested keyboard path for hover text — Added a keyboard test that arrows through a dropdown and checks data-highlighted.
  • Unreadable menu labels on keyboard focus — An authored focus background without a foreground override now uses the normal foreground.

View findings in Devin Review · Follow Devin's work

Devin Review

devin-ai-integration[bot]

This comment was marked as resolved.

@devin-ai-integration devin-ai-integration Bot changed the title feat(elements): typed styling props for menu item slots feat(elements): typed Slot_style for restricted slot constructors Nov 20, 2026

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 findings. Devin automatically fixed all 2 findings.

Fixed by Devin (2)
  • Bulk keyed mounts grow rollback journals — Reverted the direct keyed-placement change, so keyed_range is back to its base implementation.
  • Failed row mounts reject Apple updates — Reverted the direct keyed-placement change that left the node live on a failed mount.

View findings in Devin Review · Follow Devin's work

Devin Review

@tiensonqin
tiensonqin merged commit bb18c67 into main Nov 20, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant