Render native select out of screen or with clip: rect(0 0 0 0), height: 0
See original GitHub issueI realized a probelm with Select2 when using with some web framworks having client-side validation. Some frameworks use this selector to figure out elements to be validated while form submission: input:visible:enabled:not(:button)[name]
. Saidly, but the native select element in Select2 has display: none
and can not be validated. Can you render the native select out of screen please or apply this jQuery UI style class (normally applied to the surrounded div)?
.ui-helper-hidden-accessible {
border: 0;
clip: rect(0 0 0 0);
height: 0px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 0px;
}
I quess, you should also set aria-hidden
attr. to make it invisible for screen readers.
Issue Analytics
- State:
- Created 9 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
clip - CSS: Cascading Style Sheets - MDN Web Docs - Mozilla
The clip CSS property defines a visible portion of an element. ... top: 0; } #top-left { left: 400px; clip: rect(0, 130px, 90px,...
Read more >Comparing Various Ways to Hide Things in CSS
You would think that hiding content with CSS is a straightforward and solved problem, but there are multiple solutions, each one being ...
Read more >DOCTYPE html PUBLIC - mfpcc - SAMHSA
MFPError_files/screenUniversal.css"><link rel="stylesheet" media="screen" href=" ... span{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden ...
Read more >How can I tell if a DOM element is visible in the current viewport?
getBoundingClientRect(); return ( rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.
Read more >ARIA live regions in React - Almero Steyn
No, on the initial render the inside text is typically ignored by screen ... const offScreenStyle = { border: 0, clip: 'rect(0 0...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This caused some trouble for me on Chrome when working with a large dataset (in my case more than 7000 elements). Since the native select is still considered part of the render tree, selecting an option in select2 has a significant delay because displaying/removing the dropdown causes a page reflow. The browser applies the reflow to all the options in the DOM, whereas with
display:none
this is not the case.Adding this here to save others time I spent finding the cause…
Thank you!