Skip to content

Unhook the mouse down hook at the end of PropertyGridView.ProcessEnumUpAndDown #12508

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

Conversation

LeafShi1
Copy link
Member

@LeafShi1 LeafShi1 commented Nov 19, 2024

Fixes #12434

Root cause:

After changing the value by pressing up/down keyboard directly in EditTextbox, the EditTextBox.HookMouseDown will be set to True

The stack trace:

at System.Windows.Forms.PropertyGridInternal.PropertyGridView.GridViewTextBox.set_HookMouseDown(Boolean value)
at System.Windows.Forms.PropertyGridInternal.PropertyGridView.SetCommitError(ErrorState error, Boolean capture)
at System.Windows.Forms.PropertyGridInternal.PropertyGridView.OnEditChange(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnTextChanged(EventArgs e)
at System.Windows.Forms.TextBoxBase.OnTextChanged(EventArgs e)
at System.Windows.Forms.Control.set_Text(String value)
at System.Windows.Forms.TextBoxBase.set_Text(String value)
at System.Windows.Forms.TextBox.set_Text(String value)
at System.Windows.Forms.PropertyGridInternal.PropertyGridView.GridViewTextBox.set_Text(String value)
at System.Windows.Forms.PropertyGridInternal.PropertyGridView.CommitValue(GridEntry entry, Object value, Boolean closeDropDown)
at System.Windows.Forms.PropertyGridInternal.PropertyGridView.ProcessEnumUpAndDown(GridEntry entry, Keys keyCode, Boolean closeDropDown)


then pressing Alt+Down to open the DropDown list, and select a item, the CommitValue will be invoked.
At this time, EditTextBox.HookMouseDown = true. In HookMouseDown, the Focus() was invoked, so the DropDown list was collapsed.

Proposed changes

  • Set EditTextBox.HookMouseDown = false at the end of PropertyGridView.ProcessEnumUpAndDown

Customer Impact

  • When pressing the up/down keyboard in the property drop-down list, the drop-down menu will not be collapsed directly

Regression?

  • No

Risk

  • Mininal

Screenshots

Before

Pressing Up/Down keyboard in drop-down list of property collapses dropdown directly.
Image

After

When pressing the up/down keyboard in the property drop-down list, the drop-down menu will not be collapsed directly
AfterChange

Test methodology

  • Manually

Test environment(s)

  • .net 10.0.0-beta.24562.15
Microsoft Reviewers: Open in CodeFlow

@LeafShi1 LeafShi1 requested a review from a team as a code owner November 19, 2024 10:35
@LeafShi1 LeafShi1 added the waiting-review This item is waiting on review by one or more members of team label Nov 19, 2024
Copy link

codecov bot commented Nov 19, 2024

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 75.83103%. Comparing base (af49f16) to head (fd43d65).
Report is 71 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #12508         +/-   ##
===================================================
+ Coverage   75.73242%   75.83103%   +0.09860%     
===================================================
  Files           3153        3163         +10     
  Lines         635807      636411        +604     
  Branches       46975       47000         +25     
===================================================
+ Hits          481512      482597       +1085     
+ Misses        150870      150351        -519     
- Partials        3425        3463         +38     
Flag Coverage Δ
Debug 75.83103% <0.00000%> (+0.09860%) ⬆️
integration 18.17626% <0.00000%> (-0.07827%) ⬇️
production 49.45227% <0.00000%> (+0.14674%) ⬆️
test 97.05071% <ø> (+0.00077%) ⬆️
unit 46.64453% <0.00000%> (+0.38146%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@ricardobossan
Copy link
Member

I proceeded to test the changes made in this PR and the problem seems to be solved:

12508

@Tanya-Solyanik Tanya-Solyanik added the waiting-for-testing The PR is awaiting manual testing by the primary team; no action is yet required from the author(s) label Nov 27, 2024
@LeafShi1
Copy link
Member Author

No new issue was found with the private dlls

@LeafShi1 LeafShi1 removed the waiting-for-testing The PR is awaiting manual testing by the primary team; no action is yet required from the author(s) label Nov 29, 2024
@Tanya-Solyanik Tanya-Solyanik added waiting-author-feedback The team requires more information from the author and removed waiting-review This item is waiting on review by one or more members of team labels Dec 2, 2024
@dotnet-policy-service dotnet-policy-service bot removed the waiting-author-feedback The team requires more information from the author label Dec 3, 2024
@LeafShi1 LeafShi1 added the waiting-review This item is waiting on review by one or more members of team label Dec 5, 2024
Copy link
Contributor

@Tanya-Solyanik Tanya-Solyanik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@Tanya-Solyanik Tanya-Solyanik removed the waiting-review This item is waiting on review by one or more members of team label Dec 9, 2024
@LeafShi1 LeafShi1 merged commit 0ab83bf into dotnet:main Dec 9, 2024
8 checks passed
@LeafShi1 LeafShi1 deleted the Fix_12434_UnHookMoseDown_AtTheEndOf_ProcessEnumUpAndDown branch December 9, 2024 09:28
@dotnet-policy-service dotnet-policy-service bot added this to the 10.0 Preview1 milestone Dec 9, 2024
LeafShi1 added a commit to LeafShi1/winforms that referenced this pull request Dec 9, 2024
…UpAndDown (dotnet#12508)

* Unhook the mouse down hook at the end of PropertyGridView.ProcessEnumUpAndDown

* Removing ? from code line "EditTextBox?.SelectAll();"
Tanya-Solyanik pushed a commit that referenced this pull request Jan 9, 2025
…r experience in dropdown type editors in property grid (#12605)

Backport of #12508, #12431, #12356 and #12479 to release/9.0
Fixes #12607
NET10 Bugs: #12434, #12421, #12440, #12031

Bug Description
There are four issues that occur when using the up/down keys to switch property values ​​in the property page.

When navigating to "Auto Size" dropdown using the up/down arrow keys, it is getting auto selected without hitting ENTER

After using Tab to switch property values, then using the up/down keys to switch items in the drop-down box expanded by F4 will cause the drop-down box to collapse directly

[Accessibility] When using up/down to toggle property value on edit text box, The Accessibility ​​rectangle focuses on the entire property row instead of the original edit text box

[Accessibility] Narrator cannot announce items correctly when switching the items by using up/down keyboard arrow that without expand the dropdown list panel

Customer Impact
PropertyGrid drop down type editor does not support conventional keyboard navigation. Usually, selection is committed when the ENTER key is pressed. However, in this case value is committed on the Down arrow press. Then the drop down list is expanded, the screen reader user might want to navigate through all values in the drop down using the arrows, on each arrow key press the new item should be presented (and announced) in the selection text box, however, the drop down is closed on the first arrow key. According to the accessibility SMEs, this is a major problem - the keyboard users are losing their work by committing a wrong value. Screen reader user don't get correct feedback when navigating through the drop down list.
@github-actions github-actions bot locked and limited conversation to collaborators Jan 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Accessibility] Pressing Up/Down keyboard in drop-down list of property collapses drop-down directly
3 participants