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

spec exactly how to order non-window Client objects #887

Closed
wanderview opened this issue Apr 22, 2016 · 11 comments
Closed

spec exactly how to order non-window Client objects #887

wanderview opened this issue Apr 22, 2016 · 11 comments
Labels
Milestone

Comments

@wanderview
Copy link
Member

The Clients.matchAll() spec requires windows to be ordered so that most recently focused windows come first. This should also specify how to order non-window Clients.

This could probably as simple as:

  • Non-window Client objects are considered to never have been focused so always come at the end.
  • If there is a tie in focus ordering, order by creation time
@jakearchibald
Copy link
Contributor

Your words are good and I agree with them all.

@jakearchibald jakearchibald added this to the Version 1 milestone Jul 25, 2016
@aliams
Copy link
Contributor

aliams commented Jul 26, 2016

Perhaps even more generally: if there is a tie in focus ordering, order by creation time?

@jakearchibald
Copy link
Contributor

Pre F2F notes: Agree on ordering

@jakearchibald
Copy link
Contributor

F2F: Wot Ben said.

@beidson
Copy link

beidson commented Jul 28, 2016

Webkit would prefer ordering only on creation time.

Focus time would be much trickier for us, and we're not sure what benefit it would add.

@aliams
Copy link
Contributor

aliams commented Jul 28, 2016

I believe it has to do with the fact that the most likely to be picked for focusing or navigating after a notification is clicked would be the window client that was most recently in focus.

@beidson
Copy link

beidson commented Jul 28, 2016

We could easily do:

  • Most recently focused window.
  • All other windows, ordered by creation time.
  • Non-windows, ordered by creation time.

@jakearchibald
Copy link
Contributor

I missed these comments during the F2F sorry!

I think the common case is:

// in reaction to a notification click:
clients.matchAll().then(allClients => {
  const client = allClients.find(c => new URL(c.url).pathname == '/chat/');
  if (client) return client.focus();
  return clients.openWindow('/chat/');
});

If the user had two /chat/ tabs open, one of them focused, it'd be weird to take focus from one /chat/ tab to another. And it seems desirable to focus the most recently used /chat/ tab, but that's not essential.

I'd be happy if the order was:

  • Currently focused window, if any
  • Windows
  • Non-windows

And add a note to encourage browsers to order the windows & non-windows on relevancy descending.

This would allow browsers to give priority to a visible window on an active desktop etc.

WDYT @beverloo?

@jakearchibald
Copy link
Contributor

Resolution:

  • You may be looking for the most recently focused "chat" window on your origin, which may not be the most recently focused window, so having all clients ordered by recently focused is useful
  • Window clients will continue to be ordered by focus time

@aliams
Copy link
Contributor

aliams commented Sep 28, 2016

You may be looking for the most recently focused "chat" window on your origin, which may not be the most recently focused window, so having all clients ordered by recently focused is useful

Just to clarify, "all clients" do not include non-window clients, correct?

@jakearchibald
Copy link
Contributor

Since non-window clients cannot be focused they'll always be at the end of the list. @wanderview's original comment sums it up better than I did.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants