question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Render native select out of screen or with clip: rect(0 0 0 0), height: 0

See original GitHub issue

I 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:closed
  • Created 9 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
elanhamicommented, Apr 6, 2016

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…

0reactions
ova2commented, Apr 3, 2015

Thank you!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found