bluzky / nice-select2

A lightweight vanilla javascript library that replaces native select elements with customizable dropdowns
https://bluzky.github.io/nice-select2/
MIT License
370 stars 61 forks source link

height:0 and width:0 don't work on border #82

Open Petercopter opened 5 months ago

Petercopter commented 5 months ago

If there is a border on the select input then

height: 0;
width: 0;

don't work correctly to remove the input from the dom. If the border is 1px, you get a 2x2 square. Even the absolutely plain select input with no styling does this, I had to add border:0 to get it to work. image

EDIT: Well this is interesting. If you add border: 0, the input validation no longer shows...

justin-oh commented 4 months ago

I'm experiencing the original issue. In my case, I don't have a need for validation.

If setting border: 0 makes the element no longer focusable by validation, is that because it is behaving the same as a hidden element? What if all properties of the element were set to 0, except for height: 1px then offset that by margin-bottom: -1px?