Skip to content
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

fix(theme): stepper button pseudo height in number-input #4968

Open
wants to merge 1 commit into
base: canary
Choose a base branch
from

Conversation

wingkwong
Copy link
Member

@wingkwong wingkwong commented Mar 2, 2025

Closes #4920

📝 Description

currently we use pseudo classes to increase the clickable area of the stepper button. However, the decrease button covers the increase one so that when users click the increase button it will decrease the value.

⛳️ Current behavior (updates)

🚀 New behavior

💣 Is this a breaking change (Yes/No):

📝 Additional Information

Summary by CodeRabbit

  • Bug Fixes
    • Resolved a visual inconsistency affecting the stepper buttons in number input fields, ensuring that sizing and alignment are uniform across various sizes. This update enhances the overall appearance and interaction experience, delivering a more intuitive and reliable user interface. Users will notice improved responsiveness and a refined look when using number inputs.

@wingkwong wingkwong requested a review from jrgarciadev as a code owner March 2, 2025 12:49
Copy link

linear bot commented Mar 2, 2025

Copy link

changeset-bot bot commented Mar 2, 2025

🦋 Changeset detected

Latest commit: 5fe245d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@heroui/theme Patch
@heroui/autocomplete Patch
@heroui/checkbox Patch
@heroui/date-input Patch
@heroui/date-picker Patch
@heroui/form Patch
@heroui/input-otp Patch
@heroui/input Patch
@heroui/number-input Patch
@heroui/radio Patch
@heroui/select Patch
@heroui/table Patch
@heroui/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Mar 2, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
heroui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 2, 2025 0:52am
heroui-sb ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 2, 2025 0:52am

Copy link
Contributor

coderabbitai bot commented Mar 2, 2025

Walkthrough

A changelog entry was added for the @heroui/theme package, noting a patch that fixes the stepper button pseudo-height issue in the number input component (issue #4920). The number input component has updated its stepperButton class definitions across different variants and sizes by adding new style classes (before:h-4 and before:h-6). There are no changes to public or exported entities.

Changes

File Change Summary
.changeset/chatty-planets-talk.md Added changelog entry for @heroui/theme patch addressing the stepper button pseudo-height issue (issue #4920).
packages/.../number-input.ts Updated stepperButton class definitions in the number input component. New before:h-4 and before:h-6 styles were added for various size variants and contexts.

Suggested reviewers

  • jrgarciadev

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9a95a71 and 5fe245d.

📒 Files selected for processing (2)
  • .changeset/chatty-planets-talk.md (1 hunks)
  • packages/core/theme/src/components/number-input.ts (5 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .changeset/chatty-planets-talk.md
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: TypeScript
  • GitHub Check: Continuous Release
  • GitHub Check: Build
🔇 Additional comments (8)
packages/core/theme/src/components/number-input.ts (8)

711-712: Adding before:h-6 for 'inside' variant addresses button overlap issue.

This change adjusts the height of the pseudo-element for stepper buttons in the 'inside' variant with 'sm' and 'md' sizes, reducing it from the default 8 units to 6 units, which helps prevent the decrease button from overlapping with the increase button as described in issue #4920.


790-791: Properly sized clickable area for 'outside' small variant.

Setting before:h-4 for small-sized stepper buttons in the 'outside' variant creates an appropriately sized clickable area that prevents overlapping with other UI elements, addressing the core issue.


804-805: Consistent sizing for medium 'outside' variant.

Applying the same before:h-4 style to medium-sized stepper buttons maintains consistency with the small variant while preventing the button overlap issue.


818-819: Comprehensive update for large 'outside' variant.

This change not only adds the before:h-6 pseudo-element height but also maintains the existing dimensions (min-4 w-4 h-4), ensuring the large variant has appropriate clickable areas without overlapping issues.


827-828: Fixed clickable area for 'outside-left' small variant.

Adding before:h-4 to the small-sized 'outside-left' variant ensures consistent behavior with the 'outside' variant while addressing the button overlap issue.


835-836: Consistent sizing for medium 'outside-left' variant.

This change maintains consistency with other medium-sized variants by adding the before:h-4 property, ensuring the stepper buttons have appropriate clickable areas.


843-844: Complete solution for large 'outside-left' variant.

Similar to the large 'outside' variant, this change provides both dimensional properties (min-4 w-4 h-4) and the pseudo-element height (before:h-6), ensuring consistent behavior across all placement variants.


68-87:

✅ Verification successful

Verify that pseudo-element changes don't affect other functionality.

The additions of different before:h-* values modify the default before:h-8 set in the base definition. While this fixes the overlap issue, it's important to ensure these changes don't cause other unintended side effects.


🏁 Script executed:

#!/bin/bash
# Search for any other components or tests that might be using or relying on the number-input stepperButton pseudo-element height

# Check if there are any tests for the number-input component
echo "Checking for number-input tests..."
fd -t f "number-input.test" -E "node_modules"

# Check for any styles that might be overriding these pseudo-elements
echo "Checking for any other styles that might target the stepper button pseudo-elements..."
rg "before:h-\d+" -g "*.{ts,tsx,js,jsx}" -v "packages/core/theme/src/components/number-input.ts"

Length of output: 21968


Ensure pseudo-element height modifications remain isolated and don’t cause regressions.

After verifying the codebase:

  • We located the test file at packages/components/number-input/__tests__/number-input.test.tsx, which confirms that the number-input component is covered by tests.
  • A search for other usages of pseudo-element height (using regex for before:h-\d+) outside the number-input component revealed no conflicting styles.

It appears the explicit assignment of before:h-8 (and any variant adjustments) is now isolated to the stepperButton styling, so any height modifications intended to fix the overlap issue shouldn’t affect other components.

Please double-check during manual testing that the clear button and other related functionality render correctly in all intended states.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@wingkwong wingkwong changed the title fix(number-stepper): stepper button pseudo height fix(theme): stepper button pseudo height in number-input Mar 2, 2025
@wingkwong wingkwong added this to the v2.7.5 milestone Mar 2, 2025
Copy link

pkg-pr-new bot commented Mar 2, 2025

Open in Stackblitz

@heroui/accordion

npm i https://pkg.pr.new/@heroui/accordion@4968

@heroui/alert

npm i https://pkg.pr.new/@heroui/alert@4968

@heroui/autocomplete

npm i https://pkg.pr.new/@heroui/autocomplete@4968

@heroui/avatar

npm i https://pkg.pr.new/@heroui/avatar@4968

@heroui/badge

npm i https://pkg.pr.new/@heroui/badge@4968

@heroui/breadcrumbs

npm i https://pkg.pr.new/@heroui/breadcrumbs@4968

@heroui/button

npm i https://pkg.pr.new/@heroui/button@4968

@heroui/calendar

npm i https://pkg.pr.new/@heroui/calendar@4968

@heroui/card

npm i https://pkg.pr.new/@heroui/card@4968

@heroui/checkbox

npm i https://pkg.pr.new/@heroui/checkbox@4968

@heroui/chip

npm i https://pkg.pr.new/@heroui/chip@4968

@heroui/code

npm i https://pkg.pr.new/@heroui/code@4968

@heroui/date-input

npm i https://pkg.pr.new/@heroui/date-input@4968

@heroui/date-picker

npm i https://pkg.pr.new/@heroui/date-picker@4968

@heroui/divider

npm i https://pkg.pr.new/@heroui/divider@4968

@heroui/dropdown

npm i https://pkg.pr.new/@heroui/dropdown@4968

@heroui/drawer

npm i https://pkg.pr.new/@heroui/drawer@4968

@heroui/form

npm i https://pkg.pr.new/@heroui/form@4968

@heroui/image

npm i https://pkg.pr.new/@heroui/image@4968

@heroui/input

npm i https://pkg.pr.new/@heroui/input@4968

@heroui/input-otp

npm i https://pkg.pr.new/@heroui/input-otp@4968

@heroui/kbd

npm i https://pkg.pr.new/@heroui/kbd@4968

@heroui/link

npm i https://pkg.pr.new/@heroui/link@4968

@heroui/listbox

npm i https://pkg.pr.new/@heroui/listbox@4968

@heroui/menu

npm i https://pkg.pr.new/@heroui/menu@4968

@heroui/modal

npm i https://pkg.pr.new/@heroui/modal@4968

@heroui/navbar

npm i https://pkg.pr.new/@heroui/navbar@4968

@heroui/number-input

npm i https://pkg.pr.new/@heroui/number-input@4968

@heroui/pagination

npm i https://pkg.pr.new/@heroui/pagination@4968

@heroui/popover

npm i https://pkg.pr.new/@heroui/popover@4968

@heroui/progress

npm i https://pkg.pr.new/@heroui/progress@4968

@heroui/radio

npm i https://pkg.pr.new/@heroui/radio@4968

@heroui/ripple

npm i https://pkg.pr.new/@heroui/ripple@4968

@heroui/scroll-shadow

npm i https://pkg.pr.new/@heroui/scroll-shadow@4968

@heroui/select

npm i https://pkg.pr.new/@heroui/select@4968

@heroui/skeleton

npm i https://pkg.pr.new/@heroui/skeleton@4968

@heroui/slider

npm i https://pkg.pr.new/@heroui/slider@4968

@heroui/snippet

npm i https://pkg.pr.new/@heroui/snippet@4968

@heroui/spacer

npm i https://pkg.pr.new/@heroui/spacer@4968

@heroui/spinner

npm i https://pkg.pr.new/@heroui/spinner@4968

@heroui/switch

npm i https://pkg.pr.new/@heroui/switch@4968

@heroui/table

npm i https://pkg.pr.new/@heroui/table@4968

@heroui/tabs

npm i https://pkg.pr.new/@heroui/tabs@4968

@heroui/toast

npm i https://pkg.pr.new/@heroui/toast@4968

@heroui/tooltip

npm i https://pkg.pr.new/@heroui/tooltip@4968

@heroui/user

npm i https://pkg.pr.new/@heroui/user@4968

@heroui/react

npm i https://pkg.pr.new/@heroui/react@4968

@heroui/system

npm i https://pkg.pr.new/@heroui/system@4968

@heroui/system-rsc

npm i https://pkg.pr.new/@heroui/system-rsc@4968

@heroui/theme

npm i https://pkg.pr.new/@heroui/theme@4968

@heroui/use-aria-accordion

npm i https://pkg.pr.new/@heroui/use-aria-accordion@4968

@heroui/use-aria-accordion-item

npm i https://pkg.pr.new/@heroui/use-aria-accordion-item@4968

@heroui/use-aria-button

npm i https://pkg.pr.new/@heroui/use-aria-button@4968

@heroui/use-aria-link

npm i https://pkg.pr.new/@heroui/use-aria-link@4968

@heroui/use-aria-modal-overlay

npm i https://pkg.pr.new/@heroui/use-aria-modal-overlay@4968

@heroui/use-aria-multiselect

npm i https://pkg.pr.new/@heroui/use-aria-multiselect@4968

@heroui/use-callback-ref

npm i https://pkg.pr.new/@heroui/use-callback-ref@4968

@heroui/use-clipboard

npm i https://pkg.pr.new/@heroui/use-clipboard@4968

@heroui/use-data-scroll-overflow

npm i https://pkg.pr.new/@heroui/use-data-scroll-overflow@4968

@heroui/use-disclosure

npm i https://pkg.pr.new/@heroui/use-disclosure@4968

@heroui/use-draggable

npm i https://pkg.pr.new/@heroui/use-draggable@4968

@heroui/use-image

npm i https://pkg.pr.new/@heroui/use-image@4968

@heroui/use-infinite-scroll

npm i https://pkg.pr.new/@heroui/use-infinite-scroll@4968

@heroui/use-intersection-observer

npm i https://pkg.pr.new/@heroui/use-intersection-observer@4968

@heroui/use-is-mobile

npm i https://pkg.pr.new/@heroui/use-is-mobile@4968

@heroui/use-measure

npm i https://pkg.pr.new/@heroui/use-measure@4968

@heroui/use-pagination

npm i https://pkg.pr.new/@heroui/use-pagination@4968

@heroui/use-is-mounted

npm i https://pkg.pr.new/@heroui/use-is-mounted@4968

@heroui/use-real-shape

npm i https://pkg.pr.new/@heroui/use-real-shape@4968

@heroui/use-ref-state

npm i https://pkg.pr.new/@heroui/use-ref-state@4968

@heroui/use-resize

npm i https://pkg.pr.new/@heroui/use-resize@4968

@heroui/use-safe-layout-effect

npm i https://pkg.pr.new/@heroui/use-safe-layout-effect@4968

@heroui/use-scroll-position

npm i https://pkg.pr.new/@heroui/use-scroll-position@4968

@heroui/use-ssr

npm i https://pkg.pr.new/@heroui/use-ssr@4968

@heroui/use-theme

npm i https://pkg.pr.new/@heroui/use-theme@4968

@heroui/use-update-effect

npm i https://pkg.pr.new/@heroui/use-update-effect@4968

@heroui/aria-utils

npm i https://pkg.pr.new/@heroui/aria-utils@4968

@heroui/dom-animation

npm i https://pkg.pr.new/@heroui/dom-animation@4968

@heroui/framer-utils

npm i https://pkg.pr.new/@heroui/framer-utils@4968

@heroui/react-rsc-utils

npm i https://pkg.pr.new/@heroui/react-rsc-utils@4968

@heroui/react-utils

npm i https://pkg.pr.new/@heroui/react-utils@4968

@heroui/shared-icons

npm i https://pkg.pr.new/@heroui/shared-icons@4968

@heroui/shared-utils

npm i https://pkg.pr.new/@heroui/shared-utils@4968

@heroui/stories-utils

npm i https://pkg.pr.new/@heroui/stories-utils@4968

@heroui/test-utils

npm i https://pkg.pr.new/@heroui/test-utils@4968

commit: 5fe245d

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.

[BUG] - NumberInput's arrow always decrease value with outside label
2 participants