Test for WebKit based browsers instead of Safari #5437
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The previous
IS_SAFARI
test did not catch some WebKit based environments that should have the special cased behavior. For example, running Slate inside a webview on iOS would result in a userAgent like:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
which would not match the previousIS_SAFARI
definition, but does have the same quirks since it is WebKit based.Issue
No matching issue reported.
Example
One manifestation of this is the special behavior for Chrome/Safari (i.e. WebKit) for handling deleting selected inline voids relevant code.
Prior to this change in a webview on iOS it would fail to delete a selected inline void since this special cased behavior wouldn't fire -- in these videos the input is a webview inside a react-native application; the webview is then using Slate and "design-triage" is an inline void element:
Screen.Recording.2023-05-30.at.10.59.40.AM.mov
After this change it deletes as expected:
Screen.Recording.2023-05-30.at.10.56.35.AM.mov
Checks
yarn test
.yarn lint
. (Fix errors withyarn fix
.)yarn start
.)yarn changeset add
.)