Bug 255335 - hidden attribute doesn't work on select's option and optgroup
Summary: hidden attribute doesn't work on select's option and optgroup
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: Safari 16
Hardware: Mac (Apple Silicon) macOS 13
: P2 Normal
Assignee: Nobody
URL: https://jsfiddle.net/73y0fmek/
Keywords: BrowserCompat, InRadar
Depends on:
Blocks:
 
Reported: 2023-04-12 06:54 PDT by Mattia Astorino
Modified: 2023-05-15 01:01 PDT (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mattia Astorino 2023-04-12 06:54:42 PDT
Hello, just reporting that option elements with the hidden attribute are broken and they're still visible and can be selected.

DEMO:
https://jsfiddle.net/73y0fmek/

The option "1" and the option group should not be visible like the spec say. Works with firefox and Chrome/Edge.
Comment 1 Radar WebKit Bug Importer 2023-04-12 07:57:30 PDT
<rdar://problem/107939825>
Comment 2 Alexey Proskuryakov 2023-04-12 17:28:16 PDT
We had earlier reports of this, but they seem to be duped to different bugs that are all similar yet not obviously the same. This may need some cleanup.

Cf. bug 8351, bug 25623, bug 62900, bug 169039, bug 191581
Comment 3 Karl Dubost 2023-04-12 19:40:01 PDT
In Bug 191581, Chris has done a bit of analysis about the possible why?

I followed the track of https://bugs.webkit.org/show_bug.cgi?id=191581#c2

where he said:

```
Both HTMLOptionElement and HTMLOptGroupElement have the following override:
bool rendererIsNeeded(const RenderStyle&) final { return false; }

Not sure why they do not need a renderer.
```

If we go down following the history, it has been added at a very early stage.
Thu, 6 Jul 2006 05:47:30 +0000

https://searchfox.org/wubkat/diff/1018550ecbdbd0f48c091502b7e2a0f26f8c9481/WebCore/html/HTMLOptGroupElement.h#46

Maybe… the solution is that nobody tried to remove this.
Comment 4 Karl Dubost 2023-04-12 19:49:29 PDT
I'm trying to remove them in a local branch to see what it does.
Comment 5 Karl Dubost 2023-04-13 07:27:51 PDT
So removing the RendererIsNeeded doesn't change anything to the behavior. It doesn't break things, but it doesn't improve things.