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

ui5-button: ':focus' pseudo-class is not working

Open rama1990br opened this issue 6 years ago • 2 comments

Describe the bug :focus psuedo-class when added to a ui5-button does not apply the corresponding styles to the button when it is focused.

To reproduce Steps to reproduce the behavior:

  1. Go to https://sap.github.io/ui5-webcomponents/playground/components/Button/
  2. Add ':focus' to any of the buttons and add the style 'background-color:green'
  3. Tab over to that button such that the focus is on the button
  4. Notice that the button does not have a green background.

Expected behavior Adding ':focus' pseudo-class to the button should add the corresponding styles to the button when focused on, i.e., the button should have a green background when it is focused on.

rama1990br avatar Apr 09 '20 01:04 rama1990br

Hi @rama1990br

If you wish to style the focused button you can use the focused attribute which we are setting internally:

ui5-button[focused] {
   background-color: green;
}

Best regards, Filip

fifoosid avatar Apr 09 '20 08:04 fifoosid

Hi @fifoosid, The solution proposed by you works. Thanks for the quick response!

Thanks, Rama

rama1990br avatar Apr 10 '20 15:04 rama1990br