Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] VTextField append icons are not focusable #10265

Closed
Assignees
Labels
a11y Accessibility issue C: VIcon VIcon T: bug Functionality that does not work as intended/expected
Milestone

Comments

@phiter
Copy link
Contributor

phiter commented Jan 18, 2020

Environment

Vuetify Version: 2.2.4
Vue Version: 2.6.11
Browsers: Chrome 79.0.3945.117
OS: Windows 10

Steps to reproduce

  1. Focus on the text field
  2. Try to press tab or shift tab

Expected Behavior

The append/prepend icons should get focus and have an active focus state

Actual Behavior

They don't

Reproduction Link

https://codepen.io/phiter/pen/KKwGyWR

@ghost ghost added the S: triage label Jan 18, 2020
@phiter
Copy link
Contributor Author

phiter commented Jan 18, 2020

I tested this by replacing the genIcon function in VInput.ts and while it works for VTextField it makes some VSelect tests fail because it also uses an append icon for the dropdown icon.

genIcon (
type: string,
cb?: (e: Event) => void
) {
const icon = (this as any)[`${type}Icon`]
const eventName = `click:${kebabCase(type)}`
const data: VNodeData = {
props: {
color: this.validationState,
dark: this.dark,
disabled: this.disabled,
light: this.light,
},
on: !(this.listeners$[eventName] || cb)
? undefined
: {
click: (e: Event) => {
e.preventDefault()
e.stopPropagation()
this.$emit(eventName, e)
cb && cb(e)
},
// Container has g event that will
// trigger menu open if enclosed
mouseup: (e: Event) => {
e.preventDefault()
e.stopPropagation()
},
},
}
return this.$createElement('div', {
staticClass: `v-input__icon v-input__icon--${kebabCase(type)}`,
key: type + icon,
}, [
this.$createElement(
VIcon,
data,
icon
),
])
},

    genIcon (
      type: string,
      cb?: (e: Event) => void
    ) {
      const icon = (this as any)[`${type}Icon`]
      const eventName = `click:${kebabCase(type)}`

      const data: VNodeData = {
        props: {
          color: this.validationState,
          dark: this.dark,
          disabled: this.disabled,
          light: this.light,
        },
      }

      return this.$createElement(VBtn, {
        props: {
          icon: true,
          small: true,
        },
        staticClass: `v-input__icon v-input__icon--${kebabCase(type)}`,
        key: type + icon,
        on: !(this.listeners$[eventName] || cb)
          ? undefined
          : {
            click: (e: Event) => {
              e.preventDefault()
              e.stopPropagation()

              this.$emit(eventName, e)
              cb && cb(e)
            },
            // Container has g event that will
            // trigger menu open if enclosed
            mouseup: (e: Event) => {
              e.preventDefault()
              e.stopPropagation()
            },
          },
      }, [
        this.$createElement(
          VIcon,
          data,
          icon
        ),
      ])
    },

@phiter phiter added a11y Accessibility issue C: VTextField VTextField and removed S: triage labels Jan 18, 2020
@johnleider johnleider self-assigned this Jan 19, 2020
@johnleider johnleider added T: bug Functionality that does not work as intended/expected C: VIcon VIcon and removed C: VTextField VTextField labels Jan 19, 2020
@johnleider johnleider added this to the v2.2.x milestone Jan 19, 2020
johnleider added a commit that referenced this issue Feb 4, 2020
fixes #10265
fixes #10391
fixes #10398

* fix(VIcon): use a button element for clickable icons

* test: update snapshots

* refactor(VIcon): change focus style

following spec on this makes it hard to track focused icons, other frameworks use an outline similar
to btn instead, team agrees

* fix: fix double focus/ripple in v-rating, focus style updates

* style(VIcon): change ordering

Co-authored-by: John Leider <john@vuetifyjs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment