ampproject / ampproject/amphtml

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

Ouverte
#25,653 8 commentaires 0 réactions 1 personne assignée Réclamée par @kristoferbaxter Voir sur GitHub
Component: amp-script Stale Type: Bug WG: runtime
Langage dominant
JavaScript
Étoiles
14.9k
Forks
4.1k
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

## 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.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.