home-assistant / frontend

:lollipop: Frontend for Home Assistant
https://demo.home-assistant.io
Other
4.03k stars 2.75k forks source link

Toggle switch for entity holds focus until clicked away #5898

Closed mwasowski closed 4 years ago

mwasowski commented 4 years ago

Checklist

The problem

I noticed recently that when I click an entity in card group (or single entity for that matter), the element keeps focus until anything else is clicked making it loose focus as seen on the example:

Expected behavior

When the toggle is clicked the entity looses focus.

Steps to reproduce

  1. Add entity card with any type of a switch/input boolean
  2. Change it's state.

Environment

State of relevant entities

It's not relevant to specific entity but I noticed it after I added this.

entities:
  - entity: sensor.bridge_state
  - entity: input_boolean.zigbee_permit_join
  - entity: timer.zigbee_permit_join
show_header_toggle: false
title: Zigbee
type: entities

JfI0OFu6X2

Problem-relevant configuration

Javascript errors shown in your browser console/inspector

Additional information

bramkragten commented 4 years ago

This is just how websites work, if you click something it gets focus.

mwasowski commented 4 years ago

I have to disagree or maybe I'll rephrase. The 'loosing focus' is referring to the visual aspect. The animation looks like it's stuck half way through with the round shadow around the control.

mwasowski commented 4 years ago

@bramkragten Why this was closed without even taking into consideration or allowing me to explain. This is a bug, maybe visual one but it is.

bramkragten commented 4 years ago

We just use and follow material elements/guidelines. We are not going to make changes to the behaviour of those elements.

You can create an issue upstream if you disagree.

mwasowski commented 4 years ago

Ok, this indeed might be a correct implementation according to Material Design Guidelines. This is just beyond me, I did not think that it might be the case: FtNunW3Vjl That's from: https://material-components.github.io/material-components-web-catalog/#/component/switch it behaves the same way HA toggle does.

So you were right, I think I just never realized this and never encountered this, maybe because I have more experience with Material Design in Angular and there it behaves as I was expecting, the ripple effect disappears after the action finishes: AKjHpB01jH That's from: https://material.angular.io/components/slide-toggle/overview

Sorry for opening another issue, but I was genuinely triggered. I cooled down a bit ;)