File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -265,6 +265,17 @@ export function initBridge() {
265265 sendToParent ( "mdviewrCursorSyncToggle" , { enabled } ) ;
266266 } ) ;
267267
268+ // Toggle selection color class based on iframe focus
269+ // (::selection + :focus doesn't work in WebKit)
270+ window . addEventListener ( "focus" , ( ) => {
271+ const content = document . getElementById ( "viewer-content" ) ;
272+ if ( content ) content . classList . add ( "content-focused" ) ;
273+ } ) ;
274+ window . addEventListener ( "blur" , ( ) => {
275+ const content = document . getElementById ( "viewer-content" ) ;
276+ if ( content ) content . classList . remove ( "content-focused" ) ;
277+ } ) ;
278+
268279 // Notify parent that iframe is ready
269280 sendToParent ( "mdviewrReady" , { } ) ;
270281}
Original file line number Diff line number Diff line change 412412 margin-bottom : var (--space-sm );
413413}
414414
415- /* Selection */
415+ /* Selection — match Phoenix editor selection colors.
416+ Toggled via .content-focused class on window focus/blur since
417+ ::selection + :focus doesn't work in WebKit. */
416418.markdown-body ::selection {
419+ background-color : var (--color-selection-bg-unfocused );
420+ }
421+
422+ .markdown-body .content-focused ::selection {
417423 background-color : var (--color-selection-bg );
418424}
419425
Original file line number Diff line number Diff line change 5151 --color-table-row-alt : # 252526 ;
5252 --color-table-row-hover : # 2D2D2D ;
5353
54- /* Selection */
55- --color-selection-bg : # 539bf533 ;
54+ /* Selection — match Phoenix CodeMirror selection colors */
55+ --color-selection-bg : # 0050a0 ;
56+ --color-selection-bg-unfocused : # 333f48 ;
5657
5758 /* Search highlight */
5859 --color-highlight : # ae7c1426 ;
Original file line number Diff line number Diff line change 5151 --color-table-row-alt : # f6f8fa ;
5252 --color-table-row-hover : # eef3f8 ;
5353
54- /* Selection */
55- --color-selection-bg : # 0969da33 ;
54+ /* Selection — match Phoenix CodeMirror selection colors */
55+ --color-selection-bg : # abdffa ;
56+ --color-selection-bg-unfocused : # d5dee3 ;
5657
5758 /* Search highlight */
5859 --color-highlight : # fff8c5 ;
You can’t perform that action at this time.
0 commit comments