Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retargetting of slots proposal #5

Merged
merged 6 commits into from
Sep 9, 2019
Merged

Retargetting of slots proposal #5

merged 6 commits into from
Sep 9, 2019

Conversation

dvoytenko
Copy link
Contributor

IMHO slots are a special class indirection. With a minor effort we are here able to propagate a few properties between the slot and target - or retarget in other words. This makes disabled attribute work very similar to hidden.

// 1. `disabled` doesn't apply inside subtrees. This makes it more like
// `hidden`.
// 2. re-propagate events to slots since React stops propagation.
const disabled = slot.hasAttribute('disabled');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should be propagating all attributes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. We could. Or propagate only those that the element itself doesn't have. E.g. hidden is not needed to be propagated, disabled has to be, aria-label only if button itself doesn't specify it. I updated the code. Still a couple of questions there, but might be good enough to start with.

@dvoytenko dvoytenko merged commit 82391e6 into master Sep 9, 2019
@dvoytenko dvoytenko deleted the amp-slots branch September 9, 2019 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants