ampproject / ampproject/amp-react-prototype

Slot delegation

Aperta
#42 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
TBD
Lingua principale
JavaScript
Stelle
36
Fork
6
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Consider a carousel button customization. There are two approaches to place it in carousel:
1. Clone it as a vDOM component. This has a problem of losing styles, external event handlers, and an expected DOM hierarchy.
2. Slot it. The problem is that `disabled` attribute (Web spec issue) and event handlers (React issue) do not propagate from the `slot` to the distributed button.

As a result we created the [implementation](https://github.com/ampproject/amp-react-prototype/blob/c4c7373542f30feda4a1b539db1781f88bdc5063/src/react-compat-base-element.js#L605) where we propagate state and events from the slot to button and back manually.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start with src/react-compat-base-element.js around line 605, the linked implementation of slot state and event propagation. Review the two approaches described in the issue, focusing on disabled attributes, event handlers, styles, and DOM hierarchy. The issue does not define a preferred approach or explicit completion criteria, so clarify the desired behavior before changing code.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript
Ambito
frontend
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.