Skip to content

NTP: Add useBlurWorkaround hook to fix WebKit blur issue in Omnibar #1820

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

noisysocks
Copy link
Contributor

@noisysocks noisysocks commented Jul 14, 2025

Asana Task/Github Issue: https://app.asana.com/1/137249556945/task/1210784594537119

Description

Fixes an issue in the Omnibar widget where, in the macOS browser, moving focus to the address bar doesn’t close the suggestions list.

The problem is that Safari/WebKit doesn’t trigger a blur on input elements when focus is moved to the address bar.

I noticed that Safari/WebKit does correctly remove :focus styling, though, so my “clever” workaround is to detect when :focus is removed by setting a CSS variable in the :focus style and then polling for changes to this.

Testing Steps

  1. Go to https://deploy-preview-1820--content-scope-scripts.netlify.app/build/pages/new-tab/?omnibar=true in Safari or DuckDuckGo on macOS.
  2. Type “pizza” into the Search form so that suggestions list opens.
  3. Click on the browser address bar. Suggestions list should be dismissed.

Checklist

Please tick all that apply:

  • I have tested this change locally
  • I have tested this change locally in all supported browsers
  • This change will be visible to users
  • I have added automated tests that cover this change
  • I have ensured the change is gated by config
  • This change was covered by a ship review
  • This change was covered by a tech design
  • Any dependent config has been merged

@noisysocks noisysocks added the bug Something isn't working label Jul 14, 2025
@noisysocks noisysocks requested a review from a team as a code owner July 14, 2025 05:31
Copy link

netlify bot commented Jul 14, 2025

Deploy Preview for content-scope-scripts ready!

Name Link
🔨 Latest commit 6bf58e6
🔍 Latest deploy log https://app.netlify.com/projects/content-scope-scripts/deploys/6874984740affc00083ce44b
😎 Deploy Preview https://deploy-preview-1820--content-scope-scripts.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@noisysocks noisysocks changed the title Add useBlurWorkaround hook to fix Safari blur issue on input NTP: Add useBlurWorkaround hook to fix Safari blur issue in Omnibar Jul 14, 2025
@noisysocks noisysocks changed the title NTP: Add useBlurWorkaround hook to fix Safari blur issue in Omnibar NTP: Add useBlurWorkaround hook to fix WebKit blur issue in Omnibar Jul 14, 2025
Copy link

github-actions bot commented Jul 14, 2025

Temporary Branch Update

The temporary branch has been updated with the latest changes. Below are the details:

Please use the above install command to update to the latest version.

Copy link

github-actions bot commented Jul 14, 2025

[Beta] Generated file diff

Time updated: Mon, 14 Jul 2025 05:41:19 GMT

Integration
    - integration/pages/new-tab/dist/index.css
  • integration/pages/new-tab/dist/index.js

File has changed

Windows
    - windows/pages/new-tab/dist/index.css
  • windows/pages/new-tab/dist/index.js

File has changed

Apple
    - dist/pages/new-tab/dist/index.css
  • dist/pages/new-tab/dist/index.js

File has changed

cursor[bot]

This comment was marked as outdated.

@noisysocks noisysocks force-pushed the randerson/omnibar-webkit-blur-workaround branch from 8050c8b to e20d5d2 Compare July 14, 2025 05:33
@noisysocks
Copy link
Contributor Author

noisysocks commented Jul 14, 2025

Oh, weird, the blur event fires if it’s added using addEventListener. I’m going to keep working on this.

@noisysocks noisysocks marked this pull request as draft July 14, 2025 06:01
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
None yet
Development

Successfully merging this pull request may close these issues.

1 participant