-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[v2 mac] Allow to specify webview preferences #2937
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
[v2 mac] Allow to specify webview preferences #2937
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great PR! 🙏
There's 1 thing we need to change and a couple of things to consider.
Looking into it. |
I'm using an M1 mac btw, I'm wondering is the issue can be caused by the CPU arch. Edit: I think I have a lead! |
Regarding my latest commit, why I've changed /// Type to represent a boolean value.
#if (TARGET_OS_IPHONE && __LP64__) || TARGET_OS_WATCH
#define OBJC_BOOL_IS_BOOL 1
typedef bool BOOL;
#else
#define OBJC_BOOL_IS_CHAR 1
typedef signed char BOOL; // ---> the guilty one
// BOOL is explicitly signed so @encode(BOOL) == "c" rather than "C"
// even if -funsigned-char is used.
#endif |
I tested on M2 which I guess is why it worked. Nice find. |
Yes I'll sleep a bit smarter than I woke up 😄. I was wondering if you'd like me to address video tag can not be full screen as well in this PR or I can open another one when this one is merged. |
Thanks for the fix! Let's keep the PRs separate 👍 |
Thanks for this! 🙏 |
Awesome! Ill open a new PR |
Description
This PR allows to set some of the preferences for the Webview on osx, notably
tabFocusesLinks
andtextInteractionEnabled
. By default,tabFocusesLinks
is disabled, preventing the user to select links with the tab key. One could use javascript to workaround this issue, but it's very brittle and error prone. Having a way to turn this setting on increase the accessibility of the app.Fixes #2919
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
I've tested the changes locally with a project I'm currently working on by adding a replace statement in my go.mod to point to the version with my changes. I've added a recording:
wails-webkit-preference.mp4
tabFocusesLinks
is enabled, pressing tab moves the focus ring to overview, settings, etc... Also I'm not unable to select any text astextInteractionEnabled
is disabledIn the recording, to set the preferences, I was using
u.Bool
directly, it requires end user to have the package in their dependencies.It's not an issue per se but I've decided to use a more user friendly solution to avoid exposing implementation details to the end user. I've added 2 functions:
mac.EnablePreference: u.Bool
andmac.DisablePreference
.Regarding the name of the preferences, I've used the one from apple documentation.
The repository I've used in the recording is private but I can setup a simple app if needed.
Test Configuration
Checklist:
website/src/pages/changelog.mdx
with details of this PR