userVisibleOnly should be standardized to match browser behaviour

Đang mở
#313 12 bình luận 8 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tài liệu
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
html
Lĩnh vực
documentation

Hướng nghiên cứu

Read the Push API sections linked in the issue: §7 on subscribe, §10.4 on receiving a push message, and §7.2 on subscription options. The issue proposes normative changes and coordination with the Web Notifications spec; first determine whether those changes have been decided. Done means the spec clearly defines userVisibleOnly and user-visible effects, including how user agents should respond when no effect occurs.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

The current spec text does not actually require anything relating to user-visible actions, while browsers have all sorts of requirements around this concept. It currently only says this:

The userVisibleOnly member, when set to true, indicates that the push subscription will only be used for push messages whose effect is made visible to the user, for example by displaying a Web Notification.

"indicates that ... will only be used for push messages" suggests that this member is a hint passed from the site to the UA indicating how it intends to behave. Not only doesn't it require any specific action on the UA, it doesn't even suggest that the UA should do anything.

My understanding (based on a private email with @beverloo ) is that some browsers (e.g., Chrome) require userVisibleOnly (effectively making it a de facto requirement that sites set userVisibleOnly), and that many browsers (whether userVisibleOnly is set or not) impose some sort of penalty for sites that do not show a notification when receiving a push (the penalty could be showing a UA-generated notification or unsubscribing from push).

Contrary to that, it is reasonable for a developer reading this spec text to assume that both:

a) They can set userVisibleOnly to false (the default) and then receive pushes without showing a notification, and that
b) If they do set userVisibleOnly to true, it won't actually do anything, so perhaps it's fine to set it to true with the intention of showing a notification, but conditionally deciding not to show a notification in certain situations.

I understand the need to avoid mandating a particular UX in the spec, but I think the spec text could be worded a bit stronger and closer to reality.

How about:

  1. Mandating that userVisibleOnly be set to true (and note that its existence is a historical artifact). Or even removing userVisibleOnly with the assumption that it's true.
  2. Properly defining the set of actions that constitute a "user-visible effect" (at this time, just displaying a Web Notification).
  3. Suggesting (via a SHOULD requirement) what the user agent should do in the event that the message did not make a "user-visible effect".

In more detail (assuming we won't delete userVisibleOnly for now):

  • In §7, "The subscribe method", there needs to be an explicit step which rejects the promise if userVisibleOnly is false.
  • A definition of "user-visible effect", possibly creating a "user-visible effect" flag, then adding to the Web Notifications spec "set the user-visible effect" flag.
  • In §10.4, after "Then run the following steps in parallel, with dispatchedEvent," a step which checks if a "user-visible effect" was triggered during processing the event, and if not, saying that the user agent SHOULD take some action to either notify the user that non-user-visible pushes are occurring, or prevent future non-user-visible events from happening (for example, showing a notification, or removing the push registration).
  • A non-normative summary of this in §7.2 where userVisibleEffect is described.

This way, the spec creates precise logic for detecting "non-user-visible pushes", and while it doesn't mandate a specific UX response, suggests that the UA take some punitive action in this case.

Ngôn ngữ chính
HTML
Star
158
Fork
43
Merge trung bình
2 ngày 6 giờ
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của w3c/push-api

Tất cả issue của w3c/push-api

Issue tương tự

Thêm issue về Documentation

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.