Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Box-sizing improperly sets dimensions when elements are width: 100% with display: none #26

Open
r4j4h opened this issue Jan 28, 2013 · 1 comment

Comments

@r4j4h
Copy link

r4j4h commented Jan 28, 2013

This is related to a common JS problem, where an element's dimensions are un-fetchable while it is detached from the DOM from display: none or similar.

In our case, inputs with width: 100% get a width of practically zero as the parent container is display:none when the shim executes on page load. If the page resizes, or otherwise triggers the box-sizing.htc shim after being shown (when its width appears to be around zero), it pops into its normal place fine. If we have the element invisible but still in flow on page load, it works fine when eventually shown, but ideally we don't want the element in the flow.

I am honestly not sure of the best solution here, as AFAIK the dimension data is simply unavailable, but I thought I would start an issue so that others can be aware of this potential gotchya. It may very well be that it is outside of the shim's control and such DOM's or procedures must be changed instead.

This behavior does not occur in IE8+, Chrome, FF or Safari - it appears to be related entirely to the dimensions.

@markweston
Copy link

Hi @r4j4h

I have a similar issue. I've been using the polyfill on a few sites, but recently I've had issues where elements change from 'display: none' to 'display: block'.

One example is a list containing form elements. Some list elements are hidden, but show when a certain form element is selected. The hidden list elements don't seem to get the correct height even though the children of the list element seem to have a height. It's as if the polyfill doesn't correctly traverse the hidden elements children to properly assign it's height.

@Schepp Are you aware of this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants