Coder Social home page Coder Social logo

selectra's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

oguilleux

selectra's Issues

Add dropdown icon

To show it's a dropdown, add an icon on the right for both the button and the input

Customizable Popper options

For me it would esp. be helpful to change the Popper placement to something different than bottom-start.
I have not found any way (ie. hack) to access the Popper instance afterwards to change it.

Another possibility would be to expose SelectraElement so that one could access its attributes.

Keyboard navigation

Some comments:

  • Keyboard navigation is completely broken. It opens every select box without closing the previous one.
  • Clicking the value field should toggle the state of the dropdown, not just open it. At the very least the chevron should do this if you want to provide the ability to edit the input via text.
  • Animations are too slow for daily use, and there are no ways to control them via variables. Provide at least an animation timing scaling variable.
  • You should use :focus-visible instead of :focus for the keyboard navigation focus states.
  • up/down arrow don't work to select options on focus.
  • You trigger the dropdown on mousedown. This is fine, but you should support the quickselect action that's a part of the w3c spec for select boxes (mouse down to open, drag to the option you desire, mouse up to select that option and close the dropdown)

Not working on safari

Hi,

I'm using selectra like so :

import { createSelectra } from 'selectra';

const selects = document.querySelectorAll('.custom-select');

selects.forEach((select) => {
  createSelectra(select);
});

On your demo, it doesn't work on safari for the first select "Gender" either : https://cirykpopeye.github.io/selectra/

Safari v15.4
MacOs 12.3.1

Would appreciate help please !

import issue : export default not found

Hi,

When trying to import the library like so :

import Selectra from 'selectra';

I'm having this message :

export 'default' (imported as 'Selectra') was not found in 'selectra' (possible exports: createSelectra)

Can you add the class as default export as well as createSelectra please ?

Thanks

Add events

Trigger events on change / update, see which other events are useful

Escape options values and labels

Because you are using raw HTML to construct the options this may break if you have an option value with ">" character in it, or a label if you haven't escaped properly. There lots of other places in the code that could have the same problem.

Make use of documentfragment

Options are added one by one to the DOM, which causes a layout + reflow for every single option added. For performance, you should make use of a DocumentFragment.

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.