Coder Social home page Coder Social logo

Comments (4)

netshade avatar netshade commented on May 29, 2024 1

Ah, thank you - I didn't realize the Aria autocomplete behavior was all arrow key based. That combined w/ .active not applying any actual visual changes by default made it seem like things simply weren't working.

Thanks for telling me about the aria behavior, I was assuming that tabindex and tabbing between results was the correct way to specify behavior. Issue no longer valid.

from stimulus-autocomplete.

netshade avatar netshade commented on May 29, 2024

( I should note that I see in the code where there are hooks to respond to keyboard events, but they also don't appear to work for me in Safari 15.3 or Chrome 99.0.4844.51, Mac OS 12.2.1 )

from stimulus-autocomplete.

afcapel avatar afcapel commented on May 29, 2024

@netshade thanks for offering some help. The autocomplete accessibility is something I want to improve.

Technically the autocomplete is an aria combo box. According to the spec, the popup with the results should not be in the keyboard tab sequence.

Keyboard Interaction

  • Tab: The textbox is in the page Tab sequence.
  • Note: The popup indicator icon or button (if present), the popup, and the popup descendants are excluded from the page Tab sequence.

https://www.w3.org/TR/wai-aria-practices-1.1/#keyboard-interaction-6

The autocomplete already implements the rest of the keyboard interactions. However, it'd be nice if we could automatically set the aria combobox role in the autocomplete and add aria listbox role to the results.

from stimulus-autocomplete.

afcapel avatar afcapel commented on May 29, 2024

( I should note that I see in the code where there are hooks to respond to keyboard events, but they also don't appear to work for me in Safari 15.3 or Chrome 99.0.4844.51, Mac OS 12.2.1 )

You can add new event key handlers (or override existing ones) adding onXKeydown event handlers to your subclass. For example, to do something when the "a" key is pressed:

import { Autocomplete } from "stimulus-autocomplete"

export default class extends Autocomplete {
  onaKeydown = (event) => {
    console.log("a key down")
  }
}

from stimulus-autocomplete.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.