@@ -388,10 +388,19 @@ public static <T> T getView(String viewId, Class<T> viewType) {
388388 */
389389 public static Button createIconButton (Composite parent , int style ) {
390390 Button result = new Button (parent , style );
391+ final boolean [] mouseEntered = new boolean [1 ];
391392 result .addPaintListener (e -> {
392393 Rectangle bounds = result .getBounds ();
393394 e .gc .fillRectangle (0 , 0 , bounds .width , bounds .height );
394395
396+ // Draw focus indicator border for accessibility
397+ if (result .isFocusControl () && !mouseEntered [0 ]) {
398+ Color focusIndicatorColor = CssConstants .getButtonBorderColor (result .getDisplay ());
399+ e .gc .setForeground (focusIndicatorColor );
400+ e .gc .setLineWidth (1 );
401+ e .gc .drawRectangle (0 , 0 , bounds .width - 1 , bounds .height - 1 );
402+ }
403+
395404 // Draw the button's image if it has one
396405 Image image = result .getImage ();
397406 if (image != null ) {
@@ -415,11 +424,13 @@ public static Button createIconButton(Composite parent, int style) {
415424 public void focusGained (org .eclipse .swt .events .FocusEvent e ) {
416425 background = result .getBackground ();
417426 result .setBackground (focusBackground );
427+ result .redraw (); // Ensure the focus border is drawn
418428 }
419429
420430 @ Override
421431 public void focusLost (org .eclipse .swt .events .FocusEvent e ) {
422432 result .setBackground (background );
433+ result .redraw (); // Ensure the focus border is removed
423434 }
424435 });
425436
@@ -433,11 +444,13 @@ public void mouseEnter(org.eclipse.swt.events.MouseEvent e) {
433444 // the color when the mouse enters.
434445 background = result .getBackground ();
435446 result .setBackground (hoverBackground );
447+ mouseEntered [0 ] = true ;
436448 }
437449
438450 @ Override
439451 public void mouseExit (org .eclipse .swt .events .MouseEvent e ) {
440452 result .setBackground (background );
453+ mouseEntered [0 ] = false ;
441454 }
442455 });
443456 return result ;
0 commit comments