fix(VCheckbox,VRadio,VRadioGroup,VSwitch,VColorInput): expose focus - #23148
Conversation
|
I've reverted the I kept I'm going to add some changes for |
|
I need to revert a change... EDIT: VRadioGroup logic is fine at 125f1a2, so no changes are necessary |
d8f54f4 to
143eccd
Compare
This comment was marked as outdated.
This comment was marked as outdated.
The test incorrectly passed the ref object directly (v-model={model}) instead
of its value (v-model={model.value}), causing 'Assignment to constant variable'
error when the radio button was clicked.
|
Can you tell your clanker to merge instead of rebase next time so I can tell what was actually changed. |
bd6f010 to
f3aa699
Compare
630451f to
3d3f418
Compare
|
|
||
| function onFocusout (e: FocusEvent) { | ||
| if (!(e.currentTarget as HTMLElement)?.contains(e.relatedTarget as Node)) { | ||
| blur() |
There was a problem hiding this comment.
note: fires for mousedown on the inner v-radio label. Same as when using pure native controls (unless label wraps the input)
The only reliable way to counter this would be to preventDefault on label mousedown. I don't think I want to cover this until I see any real-life scenario affected.
fixes #23147
focus()andblur()were not reachable through template refs on selection controls, andVColorInputexposed nothing.focus,blur,isFocused; theVInputAPI (validate,reset, …) is still forwardedupdate:focused. Focus now reachesVInput, so the group gets the focused styles, shows the hint and validates on blur like other inputsfocus()targets the checked radio, otherwise the first enabled one in DOM order, and skips disabled radiosfocus({ focusVisible: true })shows the focus ring only when focus actually lands (not on disabled controls)VTextFieldAPIKnown limitation: with a radio focused, clicking another radio's label emits
update:focusedon the group component (false, thentrue). Native radios withforlabels behave the same.Markup:
packages/vuetify/dev/Playground.vue