Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

marcoscaceres
Copy link
Member

@marcoscaceres marcoscaceres commented Sep 9, 2025

Closes #110

This pull request clarifies how the Badging API interacts with permissions and system-level controls, both in the documentation (explainer.md) and in the example code and explanatory text (index.html). The main focus is to make it clear that setting a badge does not require explicit permission, but actual badge visibility may depend on notification permissions on some platforms. The changes also update the example code and specification language to reflect this behavior.

Clarifications to Badging API Permission Behavior:

  • Updated explainer.md to state that applications do not need to request permission to set a badge, but actual display may depend on notification permissions on some platforms.
  • Revised explanatory text in index.html to clarify that setting a badge always succeeds if the API is supported, but the operating system controls whether the badge is displayed. [1] [2]
  • Updated the specification language in index.html to remove the requirement for explicit user permission to set a badge, instead explaining that the operating system determines badge visibility and that the user agent should allow setting badges regardless of permission state. [1] [2]

Example Code Improvements:

  • Enhanced the example code in index.html to demonstrate that badges can be set regardless of notification permissions, and added an optional check for notification permission to help ensure badge visibility on relevant platforms.

This change (choose at least one, delete ones that don't apply):

  • Breaks existing normative behavior (please add label "breaking")
  • Adds new normative requirements

Implementation commitment (delete if not making normative changes):

  • Modified Web platform tests (link)
  • WebKit - behavior reflects Safari installed web applications on iOS and macOS 26.
  • Chromium
  • Gecko (http://bugzilla.mozilla.org)

Preview | Diff

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request clarifies how the Badging API interacts with permissions and system-level controls by removing the requirement for explicit permission checks before setting badges. The key change is that applications can always set badges successfully if the API is supported, but actual badge visibility depends on operating system settings and potentially notification permissions on some platforms.

  • Updates API behavior to allow badge setting without permission requirements
  • Clarifies that operating systems control badge visibility, not the web platform
  • Removes normative permission checking requirements from the specification

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
index.html Updates specification language, example code, and explanatory text to remove permission requirements and clarify OS-controlled badge visibility
explainer.md Clarifies that no permission is needed to use the badging API, though OS controls actual display

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

button.addEventListener("click", async () => {
await Notification.requestPermission();
checkPermission();
checkNotificationPermissionForBadge();
Copy link

Copilot AI Sep 9, 2025

Choose a reason for hiding this comment

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

The recursive call to checkNotificationPermissionForBadge() will set the badge again unnecessarily. Consider extracting the permission checking logic into a separate function to avoid redundant badge setting operations.

Copilot uses AI. Check for mistakes.

Copy link
Collaborator

@fallaciousreasoning fallaciousreasoning left a comment

Choose a reason for hiding this comment

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

this lgtm - I think it makes the API much nicer to use 😄

Comment on lines +83 to +84
// Errors are rare and typically indicate API unavailability
// or security restrictions, not permission issues.
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: think its probably worth removing typically here

Suggested change
// Errors are rare and typically indicate API unavailability
// or security restrictions, not permission issues.
// Errors are rare and indicate API unavailability security restrictions, not permission
// issues.

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.

Notification permission requirement

2 participants