ampproject / ampproject/amphtml

amp-script: blur() and focus() events not working on HTMLInputElement

オープン
#25,653 コメント 8 件 リアクション 0 件 担当者 1 名 @kristoferbaxter が担当を希望しています GitHub で見る
Component: amp-script Stale Type: Bug WG: runtime
主要言語
JavaScript
スター
14.9k
フォーク
4.1k
PR マージ指標
30日以内にマージされた PR はありません

説明

## What's the issue?

The `blur()` and `focus()` events on `HTMLInputElement` ought to be supported in amp-script, according to the API compatibility table here: [https://github.com/ampproject/worker-dom/blob/master/web_compat_table.md](https://github.com/ampproject/worker-dom/blob/master/web_compat_table.md)

But, they don't appear to be, based on console messages when calling`.blur()` or `.focus()`:

`TypeError: input.blur is not a function. (In 'input.blur()', 'input.blur' is undefined)`

Worth noting that the table specifies `focus()` and `blur()` only for `HTMLInputElement`s, not for generic `HTMLElement`s or anything else. It still doesn't appear to work for `HTMLInputElement`s, though.

## How do we reproduce the issue?

Here's a simple example:

```


Try me

document.querySelector(".demo-button").addEventListener("click", () => {
document.querySelector(".demo-input").blur();
});

```

## What browsers are affected?

Tested on macOS in Safari v13.0.2 & Chrome 78.0.3904.97 (64-bit)

## Which AMP version is affected?

Version 1911070201440; I'm not sure whether it's ever worked in previous versions.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。