Bug 227698 - Can't open <input type=color> with HTMLElement.click() when color input created as part of click event
Summary: Can't open <input type=color> with HTMLElement.click() when color input creat...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: Safari 14
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-07-06 02:47 PDT by Dan
Modified: 2021-07-13 02:48 PDT (History)
6 users (show)

See Also:


Attachments
input type=color vs. type=file in various scenarios (1.75 KB, text/html)
2021-07-06 02:47 PDT, Dan
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dan 2021-07-06 02:47:22 PDT
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)`.
Comment 1 Radar WebKit Bug Importer 2021-07-13 02:48:21 PDT
<rdar://problem/80508747>