-
Notifications
You must be signed in to change notification settings - Fork 111
H-5976: Fix display of tooltips for readonly inputs #8285
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
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
- Create CodeEditor component wrapping Monaco Editor with tooltip support
- Add tooltip prop to Switch component
- Update Tooltip component to optionally render based on content
- Refactor property panels to use inline tooltip pattern:
`<Tooltip content={isReadOnly ? UI_MESSAGES.READ_ONLY_MODE : undefined}>`
- Delete disabled-tooltip.tsx as it's no longer needed
This ensures tooltips show reliably on disabled elements by having
the Tooltip wrapper handle hover events instead of relying on disabled
elements.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The ArkSwitch.Root is a label element that doesn't forward all props needed by Tooltip. Wrap the switch in an ark.span container when a tooltip is provided to ensure event handlers are properly forwarded. Also refactored styles to use Panda CSS data attribute patterns (_disabled, _enabled) instead of inline conditional cursor styles. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add disabled prop that passes through to ArkSegmentGroup.Root - Add tooltip prop with ark.span wrapper for proper event forwarding - Add disabled styling (opacity, cursor: not-allowed) - Update transition-properties.tsx to use new props directly instead of external wrapper and Tooltip Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…wrapper
Instead of wrapping with ark.span (which breaks dimensions), use Ark UI's
ID composition pattern: the Tooltip and SegmentGroup container share an ID
via `ids={{ trigger: triggerId }}`, allowing the tooltip to attach without
wrapper elements.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The display:contents CSS property makes the wrapper element invisible to layout (its children are laid out as if they were direct children of the grandparent) while still allowing it to forward tooltip events. This fixes both the tooltip functionality and the layout. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use ArkTooltip.Trigger with asChild to merge event handlers directly with the ark.div container element. This avoids wrapper elements while properly forwarding tooltip trigger events. The key is that ArkTooltip.Trigger's asChild prop merges its props (including event handlers) with the child ark.div, which can properly receive them. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The delete buttons for places and transitions are now disabled when in read-only mode (during simulation), showing the read-only tooltip. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2ede0e8 to
c89a1ba
Compare
Shows a tooltip explaining that a token type must be selected to enable dynamics on the place. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The editor should remain read-only not just during running/paused simulations, but also when a simulation has completed. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Consolidates read-only state logic by using the shared hook instead of duplicating the simulation state checks locally. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Uses useIsReadOnly hook consistently across types, differential equations, and parameters lists. Both add and delete buttons are now disabled with tooltips when in read-only mode. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
PR SummaryStandardizes tooltip and read-only behavior throughout Petrinaut and prevents edits during simulation.
Written by Cursor Bugbot for commit 0b6a30c. This will update automatically on new commits. Configure here. |
🤖 Augment PR SummarySummary: This PR improves read-only UX during Petrinaut simulation by ensuring disabled/readonly controls can still display explanatory tooltips. Changes:
Technical Notes: Read-only state is now centralized via 🤖 Was this summary useful? React with 👍 or 👎 |
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.
| <div> | ||
| <div className={fieldLabelStyle}>Name</div> | ||
| <DisabledTooltip disabled={isDisabled}> | ||
| <Tooltip content={isDisabled ? UI_MESSAGES.READ_ONLY_MODE : undefined}> |
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.
Tooltip uses ArkTooltip.Trigger asChild, so if the child is a native disabled control (<input disabled>, <button disabled>, etc.) it won’t receive pointer events and the tooltip typically won’t appear. Several of the new read-only tooltips are attached to disabled native controls, so the original “tooltip on readonly hover” issue may persist in those spots.
Other Locations
libs/@hashintel/petrinaut/src/views/Editor/panels/PropertiesPanel/differential-equation-properties.tsx:312libs/@hashintel/petrinaut/src/views/Editor/panels/PropertiesPanel/differential-equation-properties.tsx:333libs/@hashintel/petrinaut/src/views/Editor/panels/PropertiesPanel/place-properties.tsx:402libs/@hashintel/petrinaut/src/views/Editor/panels/PropertiesPanel/transition-properties.tsx:322libs/@hashintel/petrinaut/src/views/Editor/panels/PropertiesPanel/type-properties.tsx:407libs/@hashintel/petrinaut/src/views/Editor/subviews/differential-equations-list.tsx:157libs/@hashintel/petrinaut/src/views/Editor/subviews/parameters-list.tsx:247libs/@hashintel/petrinaut/src/views/Editor/subviews/types-list.tsx:210
🤖 Was this useful? React with 👍 or 👎
Move cursor style to container and remove tooltip overlay that was blocking mouse interactions including scroll wheel events. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Move ArkTooltip.Trigger to wrap the entire SegmentGroup.Root instead of being nested inside it. This ensures proper component hierarchy and context distribution. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add a wrapper span around the tooltip trigger children to ensure tooltips work on disabled native elements (like buttons). Disabled elements don't receive pointer events, but the wrapper span does. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Using inline-flex caused block-level children like CodeEditor to lose their width. Using flex ensures the wrapper takes full width while still properly wrapping both block and inline elements. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Ensure the flex wrapper takes full width of its parent container so block-level children like CodeEditor don't collapse. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Block-level div elements properly contain block-level children like CodeEditor. The span element wasn't correctly handling the width inheritance for Monaco Editor containers. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The previous fix using flex with width: 100% was breaking the dimensions of input elements. This change uses inline-flex instead, which preserves the natural dimensions of input elements while still enabling tooltips on disabled elements. The inline-flex display mode ensures that: 1. Input elements maintain their intended width 2. Tooltips still work on disabled elements 3. The wrapper doesn't force unwanted width constraints 4. Alignment is preserved with align-items: center Fixes issue with Tooltip wrapper breaking dimensions of inputs.
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.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| const triggerWrapperStyle = css({ | ||
| display: "inline-flex", | ||
| alignItems: "center", | ||
| }); |
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.
Tooltip wrapper breaks full-width layout of inputs
Medium Severity
The new triggerWrapperStyle uses display: "inline-flex" which doesn't stretch to fill parent width. When Tooltip wraps elements styled with width: 100% (like inputs in parameter-properties.tsx, differential-equation-properties.tsx, type-properties.tsx), those elements won't be full-width anymore because an inline-flex container sizes to content rather than stretching. This causes visible layout shrinking in read-only mode compared to edit mode where no wrapper is applied.
| false: {}, | ||
| }, | ||
| }, | ||
| }); |
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.
CodeEditor missing flex properties for vertical fill
Medium Severity
The new CodeEditor component's containerStyle is missing flex: 1 and minHeight: 0 properties that were present in the old editorContainerStyle in differential-equation-properties.tsx. When CodeEditor is used with height="100%" inside a flex column container (like codeContainerStyle), it won't properly fill the remaining vertical space because height: 100% doesn't work correctly in flex containers without proper flex properties. The differential equations code editor will render with collapsed or incorrect height.

🌟 What is the purpose of this PR?
Fixes read-only tooltips that don't always show during simulation mode. Components now receive a
tooltipproperty directly instead of being wrapped in a<DisabledTooltip>component, ensuring tooltips display correctly on disabled elements.🔗 Related links
🔍 What does this change?
<DisabledTooltip>wrapper component and inlined tooltip logicCodeEditorcomponent wrapping Monaco Editor with tooltip supporttooltipprop toSwitchcomponent with proper event forwarding viaark.spandisabledandtooltipprops toSegmentGroupcomponent usingArkTooltip.TriggerwithasChildPlacePropertiesandTransitionPropertiesduring simulationuseIsReadOnlyhook to include "Complete" simulation stateuseIsReadOnlyhook consistently in SDCPN canvas viewPre-Merge Checklist 🚀
🚢 Has this modified a publishable library?
This PR:
📜 Does this require a change to the docs?
The changes in this PR:
🕸️ Does this require a change to the Turbo Graph?
The changes in this PR:
🛡 What tests cover this?
❓ How to test this?