refactor(dify-ui): render ContextMenu story trigger as a semantic area#38420
Merged
Conversation
…a instead of a button
Copilot created this pull request from a session on behalf of
lyzno1
July 5, 2026 01:16
View session
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #38420 +/- ##
=======================================
Coverage 85.30% 85.30%
=======================================
Files 4995 4995
Lines 264326 264326
Branches 50141 50141
=======================================
Hits 225479 225479
Misses 34429 34429
Partials 4418 4418
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
hyoban
approved these changes
Jul 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Per Base UI docs,
ContextMenu.Triggeris semantically an area (right-click / long-press) that renders a<div>by default — unlikeMenu.Trigger, which is a click-activated button. The ContextMenu story wrongly overrode the trigger withrender={<button type="button" />}, giving it incorrect button semantics (implicitrole="button", keyboard activation, extra style reset burden) that mismatch a right-click region.Changes
packages/dify-ui/src/context-menu/index.stories.tsx:TriggerAreanow applies styling viaclassNamedirectly onContextMenuTrigger, letting it render its default<div>area instead of a<button>. Visual appearance (size, border, background, focus ring) is preserved; only the button element andtype="button"are removed.Story-only, non-behavioral change; existing tests already relied on the default
<div>rendering.Screenshots
<button><div>areaChecklist
make lint && make type-check(backend) andcd web && pnpm exec vp staged(frontend) to appease the lint godsFrom Copilot