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(toggleswitch): disable + checked state and deprecated html event replacement #987

Merged
merged 4 commits into from
Sep 24, 2023

Conversation

rluders
Copy link
Collaborator

@rluders rluders commented Sep 23, 2023

As described in issue #986 the component ToggleSwitch wasn't acting as expected when checked={true} disabled={true}. This PR fixes the issue. This also replaces the deprecated onKeyPress API with onKeyDown.

Fixes #986

⚠️ This PR replaces the onKeyPress with onKeyDown. It should not break anything, since the API is only internally used.

@vercel
Copy link

vercel bot commented Sep 23, 2023

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

Name Status Preview Comments Updated (UTC)
flowbite-react ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 24, 2023 7:39am

@codecov
Copy link

codecov bot commented Sep 23, 2023

Codecov Report

Patch coverage: 71.62% and project coverage change: -6.09% ⚠️

Comparison is base (7461173) 99.54% compared to head (3f879e7) 93.46%.
Report is 88 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #987      +/-   ##
==========================================
- Coverage   99.54%   93.46%   -6.09%     
==========================================
  Files         163      182      +19     
  Lines        6621     7896    +1275     
  Branches      401      440      +39     
==========================================
+ Hits         6591     7380     +789     
- Misses         30      516     +486     
Files Changed Coverage Δ
src/components/Pagination/helpers.ts 100.00% <ø> (ø)
src/components/Toast/theme.ts 100.00% <ø> (ø)
src/components/Datepicker/Datepicker.tsx 28.00% <28.00%> (ø)
src/components/Datepicker/Views/Days.tsx 36.00% <36.00%> (ø)
src/components/Datepicker/Views/Decades.tsx 37.70% <37.70%> (ø)
src/components/Datepicker/Views/Months.tsx 37.70% <37.70%> (ø)
src/components/Datepicker/Views/Years.tsx 37.70% <37.70%> (ø)
src/components/Banner/BannerCollapseButton.tsx 40.90% <40.90%> (ø)
src/components/Datepicker/helpers.ts 60.13% <60.13%> (ø)
src/components/Banner/Banner.tsx 64.70% <64.70%> (ø)
... and 45 more

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@SutuSebastian SutuSebastian left a comment

Choose a reason for hiding this comment

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

Should we take into account throttling? Or this does not cause any issues in this case, if u simply press and hold a button.

@rluders rluders force-pushed the fix/toggleswitch-state branch from 3d0185e to 3f879e7 Compare September 24, 2023 07:37
@rluders rluders merged commit ce55df1 into themesberg:main Sep 24, 2023
2 of 4 checks passed
@rluders rluders deleted the fix/toggleswitch-state branch September 24, 2023 07:43
maman pushed a commit to transkripid/flowbite-react that referenced this pull request Oct 7, 2023
…replacement (themesberg#987)

* docs: add disabled+active toggleswitch example

* fix(toggleswitch): fix state and replace onkeypress with onkeyup

This commit fixes the state for disable + enabled ToggleSwitch and also replaces the deprecated
onKeyPress with onKeyDown

fix themesberg#986

* fix(toggleswitch): remove unused event

* refactor(toggleswitch): remove dead code
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.

ToggleSwitch checked={true} disabled={true} not visible
2 participants