Here's an example implementation of a Vue 3 dropdown component inspired by the a11y_dropdown project:
First, we'll declare an interface for the options.
index.ts60 chars5 lines
Next, we'll create the component in its simplest form, with props for the options and selected value.
1577 chars75 lines
This component makes use of several accessibility features:
Note that this implementation assumes that the button will always be present and visible on the page. If the button is hidden or removed from the DOM, the dropdown will not be accessible.
gistlibby LogSnag