Bug 244494

Summary: Scrollbar doesn't update on CSS color-scheme change
Product: WebKit Reporter: Maros <maros.pis>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: akeerthi, info, lwarlow, mmaxfield, simon.fraser, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 15   
Hardware: Mac (Apple Silicon)   
OS: macOS 12   
See Also: https://github.com/web-platform-tests/wpt/pull/40737
Bug Depends on:    
Bug Blocks: 258485    
Attachments:
Description Flags
Bug example none

Description Maros 2022-08-29 05:45:19 PDT
Created attachment 461974 [details]
Bug example

When "color-scheme" change from "light" to "dark" and vice versa colors of scrollbar aren't updated. It seems like element reflow/repaint is missing. I created jsfiddle which displays this issue. Colors are updated only after hover over scrollbar or in case scrollbar is rendered due "overflow:auto" force-reflow hack fix it too but it didn't work if scrollbar came from "overflow:scroll".

Steps to reproduce in example
1. Open in Safari
2. Click "Toggle theme - dark" button
  - page should change background color to blue but scrollbars should stay same as on yellow (white bg with grey slider)
3. Click "Force reflow"
  - top block with Lorem ipsum should change scrollbar colour to be semi-transparent (low opacity dark bg and grey slider), but lower block with horizontal & vertical scrollbar should stay same
4. Hover over scrollbars of bottom Lorem ipsum
  - scrollbars should turn to semi-transparend but bottom right edge should stay white


Example in attachement & in JSFiddle https://jsfiddle.net/marospistej/vj9tf2on/41/

Issue is only present on Safari, all Chrome, FF change scrollbar color as expected even without reflow

Expected behaviour:
When "color-scheme" change scrollbars should update
Comment 1 Maros 2022-08-29 06:49:16 PDT
It's also necessary to set "Show scroll bars" to "Always" in Settings > General
Comment 2 Peter 2022-09-02 06:21:25 PDT
Happens on macOS Ventura as well.
Comment 3 Radar WebKit Bug Importer 2022-09-05 05:46:17 PDT
<rdar://problem/99567600>
Comment 4 Luke Warlow 2023-06-23 14:46:59 PDT
Pull request: https://github.com/WebKit/WebKit/pull/15264
Comment 5 Luke Warlow 2023-06-24 09:40:51 PDT
See also URL: https://github.com/web-platform-tests/wpt/pull/40737

(I don't have permission to edit the bug)
Comment 6 EWS 2023-07-20 03:02:19 PDT
Committed 266176@main (044d44c8940b): <https://commits.webkit.org/266176@main>

Reviewed commits have been landed. Closing PR #15264 and removing active labels.