igniteui-webcomponents icon indicating copy to clipboard operation
igniteui-webcomponents copied to clipboard

fix(button/button-group): styles updates

Open SisIvanova opened this issue 10 months ago • 9 comments

Closes #1107

SisIvanova avatar Mar 27 '24 14:03 SisIvanova

Fluent I know that the focus in this PR is not Fluent, but it was mentioned that some changes have also been made there, so I checked it.

Button Group https://github.com/IgniteUI/igniteui-angular/assets/127843837/662996be-a147-4ebf-b2c7-1c0edfd43af4 as we discussed, the focused border shouldn't stay after interaction with the button. Applicable for Light and Dark mode.

Bootstrap Same thing as in Fluent.

Material Same thing as in Fluent and Bootstrap.

Same issue in Buttons for all themes.

Everything else looks good.

AnjiManova avatar Apr 24 '24 13:04 AnjiManova

Button Group

  • Material: Min-width of the button group button should be 42px;
  • Fluent: Min-width of the button group button should be 42px;
  • Bootstrap: Min-width of the button group button should be 42px;

imincheva avatar Apr 26 '24 12:04 imincheva

@SisIvanova

Does this PR require the addition of new properties to the button components? Can this be accomplished using only :focus and :focus-visible, or is there something I'm overlooking?

rkaraivanov avatar Apr 29 '24 11:04 rkaraivanov

@SisIvanova

Does this PR require the addition of new properties to the button components? Can this be accomplished using only :focus and :focus-visible, or is there something I'm overlooking?

We need this new property to remove the focus styles after clicking on the button which cannot be achieved only using :focus and :focus-visible. The same approach is used in the switch/checkbox/radio components.

SisIvanova avatar Apr 29 '24 12:04 SisIvanova

@SisIvanova Does this PR require the addition of new properties to the button components? Can this be accomplished using only :focus and :focus-visible, or is there something I'm overlooking?

We need this new property to remove the focus styles after clicking on the button which cannot be achieved only using :focus and :focus-visible. The same approach is used in the switch/checkbox/radio components.

I still believe it's feasible to attain the same functionality using only CSS pseudo-selectors, unless my understanding of the specification is incorrect. The introduction of :focus-visible, which allows different styling based on "browser heuristics" — typically the distinction between pointer and keyboard-driven focus — supports this notion.

In my experimentation with the toggle button, it appears to exhibit identical behavior after removing the extra JavaScript properties, the focused DOM element part, and its references in the Fluent style file, along with implementing the subsequent modifications to the Fluent styles:

:host {
    [part='toggle'] {
        min-height: $fluent-flat-btn-size;
        border-width: $group-item-border-thickness;
    }

    [part='toggle']:focus {
        background: var-get($theme, 'item-background');
    }

    [part='toggle']:focus-visible {
        background: var-get($theme, 'item-background');

        &::after {
            content: '';
            position: absolute;
            inset-block-start: $outline-btn-indent;
            inset-inline-start: $outline-btn-indent;
            pointer-events: none;
            width: calc(100% - (#{$outline-btn-indent} * 2));
            height: calc(100% - (#{$outline-btn-indent} * 2));
            box-shadow: 0 0 0 rem(1px) var-get($theme, 'item-focused-border-color');
        }
    }
}

As I'm not well-versed in CSS, I'm uncertain about the ease, scalability, and applicability of this approach to our component library, so I will limit my comments to the JavaScript aspects. We should consider if it's possible to simplify the implementation of these behaviors without relying on additional JavaScript code.

@simeonoff

rkaraivanov avatar Apr 29 '24 14:04 rkaraivanov

@SisIvanova Does this PR require the addition of new properties to the button components? Can this be accomplished using only :focus and :focus-visible, or is there something I'm overlooking? @SisIvanova

We need this new property to remove the focus styles after clicking on the button which cannot be achieved only using :focus and :focus-visible. The same approach is used in the switch/checkbox/radio components.

I still believe it's feasible to attain the same functionality using only CSS pseudo-selectors, unless my understanding of the specification is incorrect. The introduction of :focus-visible, which allows different styling based on "browser heuristics" — typically the distinction between pointer and keyboard-driven focus — supports this notion.

In my experimentation with the toggle button, it appears to exhibit identical behavior after removing the extra JavaScript properties, the focused DOM element part, and its references in the Fluent style file, along with implementing the subsequent modifications to the Fluent styles:

:host {
    [part='toggle'] {
        min-height: $fluent-flat-btn-size;
        border-width: $group-item-border-thickness;
    }

    [part='toggle']:focus {
        background: var-get($theme, 'item-background');
    }

    [part='toggle']:focus-visible {
        background: var-get($theme, 'item-background');

        &::after {
            content: '';
            position: absolute;
            inset-block-start: $outline-btn-indent;
            inset-inline-start: $outline-btn-indent;
            pointer-events: none;
            width: calc(100% - (#{$outline-btn-indent} * 2));
            height: calc(100% - (#{$outline-btn-indent} * 2));
            box-shadow: 0 0 0 rem(1px) var-get($theme, 'item-focused-border-color');
        }
    }
}

As I'm not well-versed in CSS, I'm uncertain about the ease, scalability, and applicability of this approach to our component library, so I will limit my comments to the JavaScript aspects. We should consider if it's possible to simplify the implementation of these behaviors without relying on additional JavaScript code.

@simeonoff

Yeah, you are correct in your assessment and we are aware of the focus-visible pseudo selector and we're using it extensively wherever we can. I believe there were some issues that couldn't be overcome by simply using it in the case of the button, but Silvia can expand on that.

simeonoff avatar Apr 29 '24 14:04 simeonoff

@rkaraivanov We have different focus styles depending on if the button is focused via keyboard or mouse click. If you focus a button using keyboard and then click on it with the mouse, the "keyboard focus styles" should be removed. Here is an example with the suggested CSS code:

https://github.com/IgniteUI/igniteui-webcomponents/assets/59446295/2a88289e-016f-4d7f-843d-b712cf806d5c

As you can see, the focus-visible box-shadow remains visible. The same thing goes for the button component.

SisIvanova avatar Apr 30 '24 06:04 SisIvanova

Button Group

Material & Fluent:

  • right and left paddings are 16 for all sizes, they should be 8, 12 and 16 (small, medium and large) ✅ implemented

Bootstrap:

  • right and left paddings are 8, 10 and 12 should be, 8, 12 and 16 (small, medium and large) ✅ implemented

Indigo:

  • for medium the paddings are correct @andiesm813, could you please provide/validate the small and large size paddings

AnjiManova avatar May 07 '24 13:05 AnjiManova

Button Group

Material, Fluent & Bootstrap:

  • The active state triggered by the keyboard is not working as in the Angular repo for some reason ✅ implemented

AnjiManova avatar May 07 '24 13:05 AnjiManova

From our side, everything looks fine, and all comments for Material, Fluent and Bootstrap are implemented.

AnjiManova avatar May 08 '24 08:05 AnjiManova

Button Group

Material & Fluent:

  • right and left paddings are 16 for all sizes, they should be 8, 12 and 16 (small, medium and large) ✅ implemented

Bootstrap:

  • right and left paddings are 8, 10 and 12 should be, 8, 12 and 16 (small, medium and large) ✅ implemented

Indigo:

  • for medium the paddings are correct @andiesm813, could you please provide/validate the small and large size paddings

INDIGO THEME

I will just list the correct left and right paddings here:

  • Small: 6px
  • Medium: 8px ✅
  • Large: 10px

Like @AnjiManova said, the medium size is correctly implemented. The other 2 need to be fixed.

andiesm813 avatar May 08 '24 15:05 andiesm813

The comments for Indigo Theme were implemented. So looks good to me! ✅✅✅

andiesm813 avatar May 08 '24 16:05 andiesm813