Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessibility: The focus dotline rectangle for Button cannot be visible obviously when using keyboard focus it #4538

Closed
Olina-Zhang opened this issue Feb 8, 2021 · 2 comments · Fixed by #6305
Assignees
Labels
💥 regression-preview Regression from a preview release tenet-accessibility MAS violation, UIA issue; problems with accessibility standards

Comments

@Olina-Zhang
Copy link
Member

  • .NET Core Version:
    6.0.100-preview1.1.21107.2

  • Have you experienced this same bug with .NET Framework?:
    No

  • More Info:

  1. This is a regression issue, cannot repro in .Net Core 3.1 and .Net 5.0 builds
  2. This issue cannot repro using mouse click buttons

Minimal repro:

  1. Create a Winforms .Net Core app
  2. Add several buttons to form designer
  3. Build and run app
  4. Use Tab keyboard to focus on buttons, observe

Actual behavior:
The focus dotline rectangle for Button cannot be visible obviously, see following screenshot and GIF for 6.0
image
keyboard_Button

Expected behavior:
The focus dotline rectangle for Button is visible obviously on .Net Core 3.1 or .Net 5.0, see following screenshot and GIF for 5.0
image
keyboard_Button_5 0

@Olina-Zhang Olina-Zhang added the tenet-accessibility MAS violation, UIA issue; problems with accessibility standards label Feb 8, 2021
@wjk
Copy link
Contributor

wjk commented Feb 19, 2021

If the buttons are using the System FlatStyle, this is something we cannot fix, as the line in question is drawn by native code in user32 and uxtheme.

However, if the buttons use the Standard FlatStyle (which is the default), bitmaps of the button background are retrieved from UXTheme and drawn using standard GDI+. In this case, we can draw whatever we want on top of them. ControlPaint.DrawFocusRectangle() was never updated for High-DPI; it always draws a 1-physical-pixel line. This we can fix ourselves, as ControlPaint uses a managed GDI+ Pen to draw the line. I only use the System FlatStyle because then the buttons cross-fade between states like raw Win32 buttons (the Standard FlatStyle just jumps immediately between states). There is nothing to say we can't implement cross-fading on a Standard Button, as the cross-fade algorithm is public API. One might submit a PR adding a wrapper for BeginBufferedAnimation et al into WinForms as a standalone class (it can crossfade between any two bitmaps, not just button frames), and then rewrite Standard Button to use it.

@vladimir-krestov vladimir-krestov added the 💥 regression-preview Regression from a preview release label Nov 10, 2021
@ghost ghost added the 🚧 work in progress Work that is current in progress label Dec 7, 2021
Tanya-Solyanik pushed a commit that referenced this issue Dec 8, 2021
…le (#6305)

Fixes #4538
After zooming in its visible that dotted line rectangle for the focused Button with FlatStyle set to Standard is still there, but it intersects with the blue border:
This intersection happens because the focus rectangle is inflated for one pixel, and to fix this issue we should add a condition on this inflating to exclude the Standard FlatStyle case
@ghost ghost removed the 🚧 work in progress Work that is current in progress label Dec 8, 2021
@John-Qiao
Copy link
Member

Verified this issue on .NET SDK 7.0.100-alpha.1.22060.5, issue was fixed.
TestResult-4538

@Lydia-Shi Lydia-Shi added this to the 7.0 Preview1 milestone Jan 12, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Feb 11, 2022
@RussKie RussKie removed this from the 7.0 Preview1 milestone May 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
💥 regression-preview Regression from a preview release tenet-accessibility MAS violation, UIA issue; problems with accessibility standards
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants