Skip to content

Conversation

@gregorw
Copy link

@gregorw gregorw commented Feb 24, 2023

Description

The form switch or toggle component is in limbo state when $enable-rounded: false. The box is rectangular while the toggle is round. Just like this:

image

Motivation & Context

This change fixes the bug where a form switch is displayed as rectangle with a round toggle image.

image

Please see also https://gregorw.github.io/bootstrap-switch-bugfix/.

Type of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would change existing functionality)

Checklist

  • I have read the contributing guidelines
  • My code follows the code style of the project (using npm run lint)
  • My change introduces changes to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

Live previews

Related issues

@maciek-szn
Copy link
Contributor

Or vice versa - rectangular switch with a square instead of a circle.

@mdo
Copy link
Member

mdo commented Mar 2, 2023

I think these are fine to square off, but yes, it'd be better if the embedded SVG was also updated when rounded corners are disabled.

@gregorw gregorw force-pushed the main branch 2 times, most recently from 7fb6f49 to 61478ad Compare March 19, 2023 21:49
@gregorw gregorw marked this pull request as ready for review March 19, 2023 22:08
@gregorw gregorw requested a review from a team as a code owner March 19, 2023 22:08
@gregorw
Copy link
Author

gregorw commented Mar 19, 2023

Alright @maciek-szn and @mdo, I have updated according to your suggestion. When $enable-rounded is switched off the form switch is now rectangular / square. Please see the demo: https://gregorw.github.io/bootstrap-switch-bugfix/

I was hesitating to introduce the first @if statement in _variables.scss. Alternatively, we could use a dedicated function. Would you rather prefer that? What do you think?

I just realized that in #38277 the same thing was fixed a few hours ago…

@gregorw gregorw force-pushed the main branch 3 times, most recently from 55352bd to 0c9aeaa Compare March 20, 2023 10:33
@gregorw gregorw changed the title Form Switch should be rounded always Fix form switch glitch Mar 20, 2023
@gregorw
Copy link
Author

gregorw commented Mar 23, 2023

@mdo Would you mind reviewing this?

`$enable-rounded` turns round corners into sharp edges. For consistency, this should apply to the form switch component, too.

The form switch or toggle component should always be rounded even when `$enable-rounded: false`. A rectangular toggle may be thinkable but requires additional design effort.
@mdo
Copy link
Member

mdo commented Jul 6, 2023

Compared to #38277, this PR would require us to wait for v5.4.0 as there's a new Sass variable being added here. Will think on it more and decide soon!

@mdo mdo added this to v5.4.0 Apr 9, 2025
@github-project-automation github-project-automation bot moved this to Needs review in v5.4.0 Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Needs review

Development

Successfully merging this pull request may close these issues.

4 participants