-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Re-add the inert="" attribute #1474
Conversation
This reverts the edits made in 5ddfc78 (and b0ec716) which removed the inert attribute. The inert attribute was originally added in 2fb24fc as part of the <dialog> feature. It is currently being re-considered as part of the https://github.com/WICG/inert proposal.
Paging @notwaldorf, @smaug----, @dbolter, @travisleithead, and @hober for comments. |
Really hard to say, since the current spec underdefines how inert works. |
@smaug---- can you clarify what you mean by "or to the element which defines the css box underneath the inert area?" I don't understand this. I would think an inert element would just preventDefault with capture essentially. |
I don't think the spec does underdefine how inert works. https://html.spec.whatwg.org/multipage/interaction.html#inert
So, as Brian said, it's equivalent to preventDefault with capture - the event "never happens". |
preventDefault() doesn't affect at all to event "happening". Event listeners later in the capture phase or in target or bubble phase still get the event. So, don't know what preventDefault() has to do with this. |
Ok, I see the issue now. I think this hasn't been an issue previously because with
Does that make sense to you as a framing? |
My reading of the spec language is that (1) above makes the most sense. |
yeah. And from the spec my assumption was "probably (2) [parent meaning parentNode in DOM tree] but perhaps the spec author means (1) after all" |
Well "act as if the node was absent" to me suggests "pretend the node isn't in the DOM at all but there's just coincidentally some stuff rendered there of mysterious origin", which would tend to support (1). I do think as well that in practice this situation is unlikely to arise, but we do definitely need to understand how it should act if it does. |
One issue that came up in @alice's prototyping is that it might be good to add |
Actually, it's included in the polyfill: https://github.com/alice/inert/blob/master/inert.js#L427 - Brian added it to his demo before it was added to the polyfill, but it's no longer necessary using that polyfill. However, I agree it should be part of the spec. |
Note that the selector needs to be more specific than
(or we should drop the |
As this is still marked 'needs implementor interest': we're interested. |
Would it be fair to say the two remaining bits of work are:
Are there any others that folks can think of? |
Super-great to have multi-implementer interest! @robdodson, your list seems right. (Plus rebasing.) Would you or @alice be able to take over this pull request? Happy to give write access to non-master branches to either of you. We'll also need web platform tests; they've become a required part of the working mode since this PR was originally posted. That will be especially good for getting interop on the event behavior (using webdriver to simulate a click). |
Working on updating the spec now. Re click behaviour, I see there is now (confusingly it seems to date back to 2014?) this paragraph clarifying the behaviour: <p class="example">For example, consider a page that consists of just a single <span>inert</span>
paragraph positioned in the middle of a <code>body</code>. If a user moves their pointing device
from the <code>body</code> over to the <span>inert</span> paragraph and clicks on the paragraph,
no <code data-x="event-mouseover">mouseover</code> event would be fired, and the <code
data-x="event-mousemove">mousemove</code> and <code data-x="event-click">click</code> events would
be fired on the <code>body</code> element rather than the paragraph.</p> Does that do the job? That seems to go with [3] from my comment above. |
Here's my attempt at adding some advice to use the default cursor: alice@f3a8b83 |
I added some WPT tests, please let me know if there are some other cases you think I should cover. |
So, both the click paragraph you cite, and the cursor note you added, are in non-normative text (an example, and a note, respectively). They don't really solve the problem, since they don't give any instructions user agents must follow. For cursor, I see two paths:
The main difference is that the first would also impact things made inert by For event behavior, I'm less clear on what the correct normative text is, but it seemed like earlier comments were on the right track. They just need to be transcribed into normative spec text. |
I updated my version of this PR:
|
Friendly ping :) Should I make a new actual PR with my changes? |
It would be good to rebase on master then force-push to this branch, but no need to close this PR and create a new one. I'll try to review soon! |
Oh, I totally forgot that this was my own PR, and not yours. Please do create your own new PR, oops! |
The new text doesn't seem right though. It has the following normative consequence: document.body.addEventListener("foo", () => console.log("foo event fired"));
document.body.inert = true;
document.body.dispatchEvent(new Event("foo")); // doesn't log anything In addition it's a pretty heavy monkeypatch to the event dispatch algorithm, although I guess that was already true for the previous patch in some ways. It seems like you're going for (3) in #1474 (comment), right? My stab at some text for that would be "User interactions which would otherwise cause events to be targeted at an inert element must instead do nothing". Not sure that's great either... Here are two ways to help formalize things a bit more:
|
New PR: #4288 |
Moving to #4288! |
This reverts the edits made in 5ddfc78 (and b0ec716) which removed the inert attribute. The inert attribute was originally added in 2fb24fc as part of the
<dialog>
feature. It is currently being re-considered as part of the https://github.com/WICG/inert proposal.This pull request is not meant to be merged until we have sufficient implementer support. @alice from Chrome is interested in implementing, but we'll need more than that before we can merge. But in the meantime, this pull request can serve as a useful concretization of https://github.com/WICG/inert, in terms of the spec change that proposal intends to effect.