fix: standardize disabled cursor to not-allowed across form components#824
fix: standardize disabled cursor to not-allowed across form components#824rohanchkrabrty wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
6ec6fa7 to
0b47881
Compare
0b47881 to
8d3b298
Compare
📝 WalkthroughWalkthroughThis pull request standardizes disabled-state cursor feedback across the Raystack component library by replacing Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/raystack/components/number-field/number-field.module.css (1)
41-46:⚠️ Potential issue | 🟡 Minor | ⚡ Quick win
pointer-events: nonecan suppress the new disabled cursor feedbackOn Line 43 and Line 67,
pointer-events: nonemay prevent thenot-allowedcursor (Line 45/69) from being shown on these controls, which weakens this PR’s consistency goal.Suggested adjustment
.decrement[data-disabled], .increment[data-disabled] { - pointer-events: none; opacity: 0.5; cursor: not-allowed; } .input[data-disabled] { - pointer-events: none; opacity: 0.5; cursor: not-allowed; }Also applies to: 66-70
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/raystack/components/number-field/number-field.module.css` around lines 41 - 46, The CSS rule for the disabled controls (.decrement[data-disabled], .increment[data-disabled]) currently uses pointer-events: none which prevents the not-allowed cursor from appearing; remove pointer-events: none from those selectors and keep opacity: 0.5 and cursor: not-allowed so the disabled cursor is visible, and enforce the disabled behavior in the component logic instead by short-circuiting the click/press handlers (check the element’s data-disabled attribute in your increment/decrement handlers such as the component methods that handle onClick/onPointerDown) to ignore events when disabled.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/raystack/components/toggle/toggle.module.css`:
- Around line 36-40: The CSS rule .toggle[data-disabled] sets pointer-events:
none which prevents the not-allowed cursor from showing; remove the
pointer-events: none declaration from .toggle[data-disabled] (and the identical
rule around lines 96-100) so the cursor: not-allowed is visible while keeping
opacity: 0.5, and ensure event/behavior-level guards in the Toggle component
(event handlers that check dataset/props disabled state) prevent interactions
instead of relying on pointer-events.
---
Outside diff comments:
In `@packages/raystack/components/number-field/number-field.module.css`:
- Around line 41-46: The CSS rule for the disabled controls
(.decrement[data-disabled], .increment[data-disabled]) currently uses
pointer-events: none which prevents the not-allowed cursor from appearing;
remove pointer-events: none from those selectors and keep opacity: 0.5 and
cursor: not-allowed so the disabled cursor is visible, and enforce the disabled
behavior in the component logic instead by short-circuiting the click/press
handlers (check the element’s data-disabled attribute in your
increment/decrement handlers such as the component methods that handle
onClick/onPointerDown) to ignore events when disabled.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5b5d830c-8df2-4e3f-878b-a04e8b243781
📒 Files selected for processing (10)
packages/raystack/components/button/button.module.csspackages/raystack/components/checkbox/checkbox.module.csspackages/raystack/components/icon-button/icon-button.module.csspackages/raystack/components/input/input.module.csspackages/raystack/components/number-field/number-field.module.csspackages/raystack/components/radio/radio.module.csspackages/raystack/components/search/search.module.csspackages/raystack/components/switch/switch.module.csspackages/raystack/components/text-area/text-area.module.csspackages/raystack/components/toggle/toggle.module.css
| .toggle[data-disabled] { | ||
| opacity: 0.5; | ||
| pointer-events: none; | ||
| cursor: not-allowed; | ||
| } |
There was a problem hiding this comment.
cursor: not-allowed won’t take effect while pointer-events: none is set.
With pointer-events: none, these elements won’t receive hover hit-testing, so the new cursor style is effectively bypassed. If the goal is visible disabled cursor feedback, remove pointer-events: none here and rely on disabled-state guards in behavior/event handling.
Also applies to: 96-100
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/raystack/components/toggle/toggle.module.css` around lines 36 - 40,
The CSS rule .toggle[data-disabled] sets pointer-events: none which prevents the
not-allowed cursor from showing; remove the pointer-events: none declaration
from .toggle[data-disabled] (and the identical rule around lines 96-100) so the
cursor: not-allowed is visible while keeping opacity: 0.5, and ensure
event/behavior-level guards in the Toggle component (event handlers that check
dataset/props disabled state) prevent interactions instead of relying on
pointer-events.
Summary
not-allowedacross all form components and buttons (button,icon-button,checkbox,radio,switch,input,text-area,select,combobox,number-field,search,toggle,color-picker).cursor: defaultonbuttonandicon-buttondisabled states withnot-allowed.checkbox, droppointer-events: noneso thenot-allowedcursor actually renders, and guard the base:hoverrule with:not([data-disabled])so disabled checkboxes no longer pick up hover styling (interaction stays blocked via the nativedisabledattribute).checkbox/otp-field[data-readonly]) ascursor: default, since read-only is distinct from disabled.