Summary: | Hidden attribute does not apply to optgroup and option | ||
---|---|---|---|
Product: | WebKit | Reporter: | Dev Eloper <develop> |
Component: | Layout and Rendering | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED DUPLICATE | ||
Severity: | Normal | CC: | bfulgham, cdumez, koivisto, rniwa, simon.fraser, webkit-bug-importer, wenson_hsieh, zalan |
Priority: | P2 | Keywords: | InRadar |
Version: | Safari 12 | ||
Hardware: | Mac | ||
OS: | macOS 10.13 | ||
URL: | https://html.spec.whatwg.org/multipage/rendering.html#the-select-element-2 | ||
See Also: | https://bugs.webkit.org/show_bug.cgi?id=169039 |
Description
Dev Eloper
2018-11-13 00:49:42 PST
Web Inspector properly reports that both the <option> and <optgroup> have "display: none" computed style, yet they are indeed visible :/ If I add "hidden" attribute the the <select> element then the <select> also becomes "display: none", and then it becomes indeed hidden. The issue is therefore specific to <option> and <optgroup> elements somehow. Also, I do not believe this is actually a DOM/HTML issue since the CSS style was properly set. This is more likely a CSS or rendering issue. Both HTMLOptionElement and HTMLOptGroupElement have the following override: bool rendererIsNeeded(const RenderStyle&) final { return false; } Not sure why they do not need a renderer. The default definition of rendererIsNeeded is: bool Element::rendererIsNeeded(const RenderStyle& style) { return style.display() != DisplayType::None && style.display() != DisplayType::Contents; } This may also be relevant: bool HTMLSelectElement::childShouldCreateRenderer(const Node& child) const { if (!HTMLFormControlElementWithState::childShouldCreateRenderer(child)) return false; #if !PLATFORM(IOS_FAMILY) if (!usesMenuList()) return is<HTMLOptionElement>(child) || is<HTMLOptGroupElement>(child) || validationMessageShadowTreeContains(child); #endif return validationMessageShadowTreeContains(child); } See also bug 169039. Our <option> rendering seems wonky. Relevant rendering code seems to be in void RenderListBox::updateFromElement(). It grabs text from options and optgroup elements without taking into consideration their visibility. Moving to Layout & Rendering. I do not think I am the right assignee. |