[FIX] website: prevent crash due to color-mix in Safari 16.5
__Current behavior before commit:__ The `color` attribute of `hr` is set to `$hr-color`[1]. `$hr-color` is equal to `$border-color`[2] which itself is equal to `--o-border-color`[3]. Finally `--o-border-color` is set using `fade-currentColor()`[4] which uses the `color-mix` css function on `currentColor`[5]. In short, the `color` of `hr` depends on itself. This creates a circular reference that makes Safari 16.5 crash. This bug is caused by WebKit. There seems to be a commit to fix[6] this bug but it looks like it was not backported to this version of Safari. __Description of the fix:__ Set `border-top` color of `hr` to `$border-color`. This way of doing gives the same result as setting `color` but removes the circular dependency with `currentColor` that makes Safari 16.5 crash. `color` is set to `inherit` to override the bootstrap rule[1] that leads to the bug. For reference, `hr` color is already set like that here[7]. __Steps to reproduce the issue on runbot:__ 1. Go to the website shop using Safari 16.5 2. Add an item to the cart 3. Open the cart view 4. Safari crashes opw-3806725 [1]: https://github.com/odoo/odoo/blob/1154556/addons/web/static/lib/bootstrap/scss/_reboot.scss#L71 [2]: https://github.com/odoo/odoo/blob/1154556/addons/website/static/src/scss/bootstrap_overridden.scss#L333 [3]: https://github.com/odoo/odoo/blob/1154556/addons/website/static/src/scss/bootstrap_overridden.scss#L91 [4]: https://github.com/odoo/odoo/blob/1154556/addons/website/static/src/scss/website.scss#L35 [5]: https://github.com/odoo/odoo/blob/1154556/addons/website/static/src/scss/primary_variables.scss#L2219 [6]: https://github.com/WebKit/WebKit/commit/0d0b884 [7]: https://github.com/odoo/odoo/blob/1154556/addons/website/static/src/snippets/s_hr/000.scss#L7 Part-of: odoo/odoo#160495 Co-authored-by: qsm-odoo <qsm@odoo.com>
This commit is contained in:
committed by
qsm-odoo
co-authored by
qsm-odoo
parent
77aadf471c
commit
3ec555eb38
@@ -406,6 +406,21 @@ $-header-nav-link-height: $nav-link-height;
|
||||
}
|
||||
}
|
||||
|
||||
hr {
|
||||
// Move the set up color as a border color. Indeed, we may use color-mix to
|
||||
// define that color as a function of currentColor, in which case
|
||||
// Safari 16.5 is known to crash when using that to set the color property.
|
||||
border-top: $hr-height solid $hr-color;
|
||||
color: inherit;
|
||||
// FIXME before the commit that introduced this background-color the color
|
||||
// of HR was the superposition of:
|
||||
// - background-color = currentColor = see below
|
||||
// - color = $hr-color = transparent mix of currentColor
|
||||
// => So a transparent version of the inherited color, on top of itself
|
||||
// => This line makes it so this stays the same for now.
|
||||
background-color: $hr-color;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: map-get($colors, 'o-cc1-h2');
|
||||
}
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
line-height: 0;
|
||||
hr {
|
||||
padding: 0;
|
||||
// TODO we already change the way the color is applied (using a border)
|
||||
// in website.css. In master, we should just let that system work the
|
||||
// way it is and not force something here.
|
||||
border: 0;
|
||||
border-top: 1px solid $border-color;
|
||||
margin: 0;
|
||||
color: inherit;
|
||||
// As BS5 added "opacity" and "background-color" on hr tag, we remove
|
||||
// that here to let users set the color as they want.
|
||||
opacity: 1;
|
||||
|
||||
Reference in New Issue
Block a user