Skip to content

Conversation

amovar18
Copy link
Collaborator

@amovar18 amovar18 commented Sep 23, 2025

Description

This PR addresses two separate issues:

  1. It refactors the browser version detection logic to use the more modern and reliable User-Agent Client Hints API (navigator.userAgentData) instead of parsing the user-agent string. A fallback to the old method is retained for browsers that don't support the new API.
  2. It fixes a bug in the sidebar's keyboard navigation where event.preventDefault() was being called too broadly, interfering with default browser actions like activating a link with the 'Enter' key.

Relevant Technical Choices

  • Browser Version Detection: The component now first attempts to use navigator.userAgentData.getHighEntropyValues(['fullVersionList']) to retrieve detailed browser and platform information. This approach is preferred as user-agent strings are becoming less reliable. If this API is not available, the logic falls back to the previous method of parsing navigator.userAgent with a regex.
  • Sidebar Keyboard Navigation: The calls to event.preventDefault() and event.stopPropagation() have been moved from the top of the onKeyNavigation handler into the specific if blocks for ArrowUp, ArrowDown, ArrowLeft, and ArrowRight. This ensures we only prevent the default browser behavior for these specific navigation actions, allowing other keys (like 'Enter' or 'Space') to function as expected on sidebar items.

Testing Instructions

Browser Version Detection

  1. Navigate to the extension's settings page.
  2. Observe the browser information displayed at the bottom.
  3. Verify that it correctly shows your Chrome version and platform (e.g., "Version 123 on Windows").
  4. If possible, test on an older browser to ensure the fallback mechanism still displays the version correctly.

Sidebar Navigation

  1. Open a view with a sidebar (e.g., the main panel).
  2. Use the ArrowUp and ArrowDown keys to navigate between items. Confirm that the selection moves as expected.
  3. If any items have sub-menus (dropdowns), use ArrowRight to open them and ArrowLeft to close them. Confirm this works correctly.
  4. Navigate to a sidebar item that is a link or has a primary action.
  5. Press the Enter key.
  6. Confirm that the default action for that item (e.g., navigating to a new page) is triggered correctly without being blocked.

Screenshot/Screencast


Checklist

  • I have thoroughly tested this code to the best of my abilities.
  • I have reviewed the code myself before requesting a review.
    - [ ] This code is covered by unit tests to verify that it works as intended. NA
  • The QA of this PR is done by a member of the QA team (to be checked by QA).

Fixes #1139
Fixes #1143

@amovar18 amovar18 marked this pull request as ready for review September 23, 2025 10:41
@amovar18 amovar18 changed the title Fix/version focus Fix: Chrome version number and fix focus in sidebar clicks Sep 24, 2025
@amovar18 amovar18 changed the title Fix: Chrome version number and fix focus in sidebar clicks Fix: Chrome version number and fix focus after sidebar use Sep 24, 2025
@amovar18 amovar18 moved this from In QA to Under Review in PS Analysis Tool Sep 24, 2025
@mohdsayed mohdsayed merged commit c657331 into develop Sep 25, 2025
6 checks passed
@github-project-automation github-project-automation bot moved this from Under Review to Done in PS Analysis Tool Sep 25, 2025
@mohdsayed mohdsayed deleted the fix/version-focus branch September 25, 2025 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Incorrect Chrome version displayed in PSAT Extension's Settings page DevTools Shortcut Bug in Privacy Sandbox Panel
3 participants