JDK-8343451 : Add persistentScrollBars preference
  • Type: CSR
  • Component: javafx
  • Sub-Component: graphics
  • Priority: P4
  • Status: Provisional
  • Resolution: Unresolved
  • Fix Versions: jfx24
  • Submitted: 2024-11-01
  • Updated: 2024-11-01
Related Reports
CSR :  
Description
Summary
-------

Add the `persistentScrollBars` platform preference.

Problem
-------

Contemporary UI design has moved to an overlay scrollbar style that tries to minimize the space taken up by scroll bars when not in active use. This preference enables JavaFX applications to query whether users have opted into overlay-style scroll bars, or prefer classic persistent scroll bars.



Solution
--------

The preference corresponds to the following OS settings:

1. Windows: Settings -> Accessibility -> Visual Effects -> Always show scroll bars
2. macOS: System Settings -> Appearance -> Show scroll bars
3. Ubuntu: Settings -> Accessibility -> Seeing -> Always show scroll bars

Specification
-------------

    --- a/modules/javafx.graphics/src/main/java/javafx/application/Platform.java
    +++ b/modules/javafx.graphics/src/main/java/javafx/application/Platform.java
    @@ -497,6 +497,7 @@
          *         <tr><td>{@code Windows.UIColor.AccentLight2}</td><td>{@link Color}</td></tr>
          *         <tr><td>{@code Windows.UIColor.AccentLight3}</td><td>{@link Color}</td></tr>
          *         <tr><td>{@code Windows.UISettings.AdvancedEffectsEnabled}</td><td>{@link Boolean}</td></tr>
    +     *         <tr><td>{@code Windows.UISettings.AutoHideScrollBars}</td><td>{@link Boolean}</td></tr>
          *         <tr></tr>
          *     </tbody>
          * </table>
    @@ -551,6 +552,7 @@
          *         <tr><td>{@code macOS.NSColor.systemYellowColor}</td><td>{@link Color}</td></tr>
          *         <tr><td>{@code macOS.NSWorkspace.accessibilityDisplayShouldReduceMotion}</td><td>{@link Boolean}</td></tr>
          *         <tr><td>{@code macOS.NSWorkspace.accessibilityDisplayShouldReduceTransparency}</td><td>{@link Boolean}</td></tr>
    +     *         <tr><td>{@code macOS.NSScroller.preferredScrollerStyle}</td><td>{@link String}</td></tr>
          *         <tr></tr>
          *     </tbody>
          * </table>
    @@ -577,6 +579,7 @@
          *         <tr><td>{@code GTK.error_color}</td><td>{@link Color}</td></tr>
          *         <tr><td>{@code GTK.success_color}</td><td>{@link Color}</td></tr>
          *         <tr><td>{@code GTK.enable_animations}</td><td>{@link Boolean}</td></tr>
    +     *         <tr><td>{@code GTK.overlay_scrolling}</td><td>{@link Boolean}</td></tr>
          *         <tr></tr>
          *     </tbody>
          * </table>
    @@ -586,6 +589,20 @@
         public sealed interface Preferences extends ObservableMap<String, Object>
                 permits com.sun.javafx.application.preferences.PlatformPreferences {
     
    +        /**
    +         * Specifies whether applications should always show scroll bars. If not set, an application may
    +         * choose to hide scroll bars that are not actively used, or make them smaller or less noticeable.
    +         * <p>
    +         * If the platform does not report this preference, this property defaults to {@code false}.
    +         *
    +         * @return the {@code persistentScrollBars} property
    +         * @defaultValue {@code false}
    +         * @since 24
    +         */
    +        ReadOnlyBooleanProperty persistentScrollBarsProperty();
    +
    +        boolean isPersistentScrollBars();
    +
             /**
              * Specifies whether applications should minimize the amount of non-essential animations,
              * reducing discomfort for users who experience motion sickness or vertigo.
Comments
Moving to Provisional.
01-11-2024