ampproject / ampproject/amphtml

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

Abierto
#25,653 8 comentarios 0 reacciones 1 asignado Reclamado por @kristoferbaxter Ver en GitHub
Component: amp-script Stale Type: Bug WG: runtime
Lenguaje dominante
JavaScript
Estrellas
14.9k
Forks
4.1k
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.