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

Meta: export terms for Notifications API #10715

Merged
merged 1 commit into from
Oct 23, 2024
Merged

Conversation

annevk
Copy link
Member

@annevk annevk commented Oct 21, 2024

In particular: a navigable's current session history entry, a user agent's top-level traversable set, and a session history entry's URL.


This is the use case I have for this in whatwg/notifications#213 (PR does not contain the long paragraph at the moment as it would result in issues):

 <li>
  <p>If <var>navigationURL</var> is non-null:

  <ol>
   <li><p>If there is an existing <a for=navigable>top-level traversable</a> <var>traversable</var>
   within the user agent's <a>top-level traversable set</a> whose
   <a for="navigable">current session history entry</a>'s <a for="session history entry">URL</a>
   <a for=url>equals</a> <var>navigationURL</var> with
   <a for=url/equals><i>exclude fragments</i></a> set to true, then <a>navigate</a>
   <var>traversable</var> to <var>navigationURL</var> and return. If there are multiple
   <a>top-level traversables</a> that satisfy the condition the user agent has to pick one in an
   <a>implementation-defined</a> manner.

   <li><p><a>Create a fresh top-level traversable</a> given <var>navigationURL</var>.
   <!-- Should maybe set userInvolvement correctly here, even though it doesn't do anything today. -->

   <li><p>Return.
  </ol>

/document-sequences.html ( diff )

@saschanaz
Copy link
Member

If there are multiple that satisfy the condition the user agent has to pick one in an implementation-defined manner.

I'm not very happy to not specify that algorithm but maybe that's off topic here.

@annevk
Copy link
Member Author

annevk commented Oct 21, 2024

What would you suggest to say instead? The way tabs are presented and the ordering they have seems quite implementation-defined material to me.

@domenic
Copy link
Member

domenic commented Oct 22, 2024

If there is an existing <a for=navigable>top-level traversable</a> <var>traversable</var>

I think this should not have the for=.

a navigable's current session history entry

Are you absolutely sure you want current, not active? Most things on the platform use active, and that represents what the user sees.

a user agent's top-level traversable set

Exporting this seems very reasonable

and a session history entry's URL.

Exporting this also seems reasonable.

Although, I wonder about this alternate approach?

If there is a top-level traversable in the user agent's top-level traversable set whose active document's URL equals...

In theory the active session history entry's URL should always be in sync with the document's URL. (In practice there are some edge cases in some browsers around javascript: URLs that we still haven't figured out: #6649.)

@saschanaz
Copy link
Member

What would you suggest to say instead? The way tabs are presented and the ordering they have seems quite implementation-defined material to me.

But still web visible, right? One can listen on visibilitychange event and guess the algorithm (whether the browser selects the last visible tab) for example. At least we should have some non-normative guide even if it's not fully spec-able.

@annevk
Copy link
Member Author

annevk commented Oct 22, 2024

@domenic thank you! I'll update this PR for your "active document" suggestion, which all around seems much better.

@saschanaz I'm not really sure what guidance we would give. This seems like the kind of thing to sort through with more deployment experience, but I honestly doubt it'll come up much.

@saschanaz
Copy link
Member

The guide could be about what the initial implementations are planning to do for tab selection.

@annevk annevk force-pushed the annevk/notifications-export branch from 863bd83 to 3ca12ab Compare October 22, 2024 13:22
@annevk
Copy link
Member Author

annevk commented Oct 22, 2024

I still don't really see how that makes sense as it's also highly dependent on how that implementation opens tabs and such. A web application doesn't know the tab order between its tabs.

@saschanaz
Copy link
Member

It doesn't know the visual tab order, if that's what Apple is planning to depend on. It does know which tab got the most recent user interaction / focus / etc.

@saschanaz
Copy link
Member

But anyway I'm not very familiar with navigable, maybe @smaug---- is a better person for this PR.

A dumb question: with the proposed behavior, would it be possible to have SPA-like behavior where the existing JS context is used with the new history entry?

Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

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

I do think there's been a good discussion here about whether we can specify the notifications API algorithm in more detail, but it should probably happen over in the notifications API repo, instead of this meta PR :)

I'll merge this now.

@domenic domenic merged commit fe70744 into main Oct 23, 2024
2 checks passed
@domenic domenic deleted the annevk/notifications-export branch October 23, 2024 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants