| Summary: | Can't open <input type=color> with HTMLElement.click() when color input created as part of click event | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Dan <dan> | ||||
| Component: | Forms | Assignee: | Nobody <webkit-unassigned> | ||||
| Status: | NEW --- | ||||||
| Severity: | Normal | CC: | akeerthi, cdumez, graouts, hi, webkit-bug-importer, wenson_hsieh | ||||
| Priority: | P2 | Keywords: | InRadar | ||||
| Version: | Safari 14 | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Attachments: |
|
||||||
Created attachment 432913 [details] input type=color vs. type=file in various scenarios As with other types of inputs, color inputs can be activated by calling their `HTMLElement.click()` method. However, invoking `inputElement.click()` immediately after creating the `inputElement` DOM element and attaching it to the document tree has no effect. Other types of inputs (e.g. `file`) works well even in this scenario. In the attached test case: A. Open existing input element with immediate `click()` — works for both `file` and `color` types; B. Open existing input element with delayed `click()` — works for both `file` and `color` types; C. Create input element as part of gesture, immediate `click()` — works for `file` type but NOT `color` type; D. Create input element as part of gesture, delayed `click()` — works for both `file` and `color` types. In other words: * color inputs don't work in scenario C, although it seems they should; * color inputs can be made to work by delaying the `click()` call with `window.setTimeout(() => { inputEl.click(); }, 0)`.