Skip to content

Conversation

@Themayu
Copy link
Contributor

@Themayu Themayu commented Aug 26, 2025

This commit exposes the scroll_bar_style option from wry via tauri's WebviewBuilder and WebviewWindowBuilder APIs, as well as the configuration and JavaScript APIs.

A continuation of tauri-apps/wry#1339, to expose this option to tauri.

@github-project-automation github-project-automation bot moved this to 📬Proposal in Roadmap Aug 26, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Aug 26, 2025

Package Changes Through e0a2031

There are 8 changes which include @tauri-apps/api with minor, tauri-cli with minor, tauri-utils with minor, tauri-runtime-wry with minor, tauri-runtime with minor, tauri with minor, tauri-bundler with minor, @tauri-apps/cli with minor

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
@tauri-apps/api 2.8.0 2.9.0
tauri-utils 2.7.0 2.8.0
tauri-bundler 2.6.1 2.7.0
tauri-runtime 2.8.0 2.9.0
tauri-runtime-wry 2.8.1 2.9.0
tauri-codegen 2.4.0 2.4.1
tauri-macros 2.4.0 2.4.1
tauri-plugin 2.4.0 2.4.1
tauri-build 2.4.1 2.4.2
tauri 2.8.5 2.9.0
@tauri-apps/cli 2.8.4 2.9.0
tauri-cli 2.8.4 2.9.0

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@Themayu
Copy link
Contributor Author

Themayu commented Aug 26, 2025

I'm not going to bother with fixing the formatting until the PR itself is ready for review.

@Themayu Themayu marked this pull request as ready for review August 26, 2025 11:58
@Themayu Themayu requested a review from a team as a code owner August 26, 2025 11:58
@Themayu
Copy link
Contributor Author

Themayu commented Aug 26, 2025

While testing this, I discovered that on Windows, attempting to create a webview from the JavaScript API will cause the hosting window to immediately hang if it attempts to use the same data directory as another webview without sharing the same environment options. The PR includes no mitigation for this behaviour, as I was told to continue as if I hadn't noticed it, and open a separate issue about it.

This extends to the configuration file and the Rust API as well, though the Rust API allows for changing the data directory. This behaviour is documented on Microsoft's website under CoreWebView2Environment.CreateCoreWebView2ControllerAsync:

WebView creation fails if a running instance using the same user data folder exists, and the Environment objects have different CoreWebView2EnvironmentOptions. For example, if a WebView was created with one CoreWebView2EnvironmentOptions.Language, an attempt to create a WebView with a different CoreWebView2EnvironmentOptions.Language using the same user data folder fails.

@Themayu
Copy link
Contributor Author

Themayu commented Aug 26, 2025

Oh. I forgot the change file. My bad, adding that now.

This commit exposes the scroll_bar_style option from wry via the tauri
WebviewWindowBuilder API. By itself, the commit does not include changes
to the configuration file or JavaScript APIs: These will be added in a
later commit.
This commit exposes the `scroll_bar_style` option in tauri.conf.json/
.json5/.toml as `scrollBarStyle` and `scroll-bar-style`.
@Themayu Themayu force-pushed the feat/windows-add-scrollbar-style-option branch from f0837a8 to e6e278e Compare August 26, 2025 13:39
This commit exposes the `scroll_bar_style` in the options object passed
to the JavaScript API `Webview` and `WebviewWindow` constructors.

While testing this, I discovered that on Windows, attempting to create
a webview from the JavaScript API will cause the hosting window to
immediately hang if it attempts to use the same data directory as
another webview without sharing the same environment options. This
commit includes no mitigation for this behaviour, as I will be opening
a separate issue about it at some point in the near future.
This commit adds a message to the documentation for all components of
the `scroll_bar_style` configuration option, telling users that all
webviews that use the same data directory must use the same value for
this option.
@Themayu Themayu force-pushed the feat/windows-add-scrollbar-style-option branch from e6e278e to 94b499b Compare August 26, 2025 13:43
@Themayu
Copy link
Contributor Author

Themayu commented Aug 26, 2025

Sorry about that, I just realised that the multiple rebases I did during this deleted some of my commit signatures. I've had to redo all of them.

@Themayu
Copy link
Contributor Author

Themayu commented Aug 26, 2025

Removed tauri-schema-generator from the change files, as per covector error message during last run.

@Themayu Themayu force-pushed the feat/windows-add-scrollbar-style-option branch from 9186789 to 1b523db Compare August 26, 2025 14:47
@Themayu
Copy link
Contributor Author

Themayu commented Aug 26, 2025

One final push to change the line endings in my change files to LF (I blame git for it being CRLF, as I have git configured to change all line endings to LF on commit.) Decided to amend it to the previous commit instead of creating a new one specifically for it, so I force pushed.

I did not realise that these were needed, as the pull request that I
used as my reference when building this feature did not have them.
@FabianLars FabianLars added this to the 2.9 milestone Aug 26, 2025
@lucasfernog
Copy link
Member

While testing this, I discovered that on Windows, attempting to create a webview from the JavaScript API will cause the hosting window to immediately hang if it attempts to use the same data directory as another webview without sharing the same environment options. The PR includes no mitigation for this behaviour, as I was told to continue as if I hadn't noticed it, and open a separate issue about it.

This extends to the configuration file and the Rust API as well, though the Rust API allows for changing the data directory. This behaviour is documented on Microsoft's website under CoreWebView2Environment.CreateCoreWebView2ControllerAsync:

WebView creation fails if a running instance using the same user data folder exists, and the Environment objects have different CoreWebView2EnvironmentOptions. For example, if a WebView was created with one CoreWebView2EnvironmentOptions.Language, an attempt to create a WebView with a different CoreWebView2EnvironmentOptions.Language using the same user data folder fails.

nice catch.. we do have options to force a webview to use the same environment a previously created one - i think we just need to track all data directories and use it accordingly

lucasfernog
lucasfernog previously approved these changes Aug 28, 2025
Copy link
Member

@lucasfernog lucasfernog left a comment

Choose a reason for hiding this comment

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

well done!

lucasfernog added a commit that referenced this pull request Aug 28, 2025
on Windows the Webview2 environment options must match when created webviews sharing the same data directory (unless specified, all webviews share the same data directory). This PR validates the options, warning if they do not match, and forces the webview to be created with the same previous environment to prevent a crash.

discovered as part of #14089
@lucasfernog lucasfernog merged commit f5851ee into tauri-apps:dev Sep 2, 2025
29 checks passed
@github-project-automation github-project-automation bot moved this from 📬Proposal to 🔎 In audit in Roadmap Sep 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🔎 In audit

Development

Successfully merging this pull request may close these issues.

3 participants