Repository: nvaccess/nvda

Issue:
[html5 input type="number"] Label missing from the Elements List when the field is not empty
<!-- Please read the text in this edit field before filling it in.
Please thoroughly read NVDA's wiki article on how to fill in this template, including how to provide the required files.
Issues may be closed if the required information is not present.
https://github.com/nvaccess/nvda/wiki/Github-issue-template-explanation-and-examples
Please also note that the NVDA project has a Citizen and Contributor Code of Conduct which can be found at https://github.com/nvaccess/nvda/blob/master/CODE_OF_CONDUCT.md. NV Access expects that all contributors and other community members read and abide by the rules set out in this document while participating or contributing to this project. This includes creating or commenting on issues and pull requests. 
-->

### Steps to reproduce:

Same test case as #7390:
Copy the following in the address bar of a supporting web browser (Firefox/Chrome/Edge Chromium):
`data:text/html, <label for="spin">Spin</label><input id="spin" type="number" min=3 max=10 />`

Open the Elements List dialog (`NVDA+F7`) and select the "Form fields" type.

Notice the sole element does have a label: "Spin".

Close the dialog and now fill the field with any value.

Re-open the Elements List dialog, select the "Form fields" type again.


### Actual behavior:

The element does not have a label anymore, and the order of value/role/states has changed.

### Expected behavior:

The label for the element should still be presented and the order of the information should not have changed, just like for any other types of form fields.

### System configuration
#### NVDA installed/portable/running from source:

installed

#### NVDA version:

2020.4

#### Windows version:

Windows 10 20H2 (19042.928)

#### Name and version of other software in use when reproducing the issue:

Firefox / Chrome / Edge Chromium

#### Other information about your system:

### Other questions
#### Does the issue still occur after restarting your computer?

Yes

#### Have you tried any other versions of NVDA? If so, please report their behaviors.

Reproducible in all NVDA versions since the introduction of the "Form fields" element type in 2017.4 (PR #6131)

#### If add-ons are disabled, is your problem still occurring?

Yes

#### Does the issue still occur after you run the COM Registration Fixing Tool in NVDA's tools menu?

Yes


Issue raised on behalf of the accessibility team at Pôle emploi, the French employment agency.
cc @rthxy, @frederic-brugnot


Upcoming PR…


Discussion:

Resolving patch:
diff --git a/source/browseMode.py b/source/browseMode.py
--- a/source/browseMode.py
+++ b/source/browseMode.py
@@ -1,6 +1,6 @@
 # A part of NonVisual Desktop Access (NVDA)
-# Copyright (C) 2007-2020 NV Access Limited, Babbage B.V., James Teh, Leonard de Ruijter,
-# Thomas Stivers
+# Copyright (C) 2007-2021 NV Access Limited, Babbage B.V., James Teh, Leonard de Ruijter,
+# Thomas Stivers, Accessolutions, Julien Cochuyt
 # This file is covered by the GNU General Public License.
 # See the file COPYING for more details.
 
@@ -252,7 +252,15 @@ def _getLabelForProperties(self, labelPropertyGetter):
 			realStates = labelPropertyGetter("states")
 			labeledStates = " ".join(controlTypes.processAndLabelStates(role, realStates, OutputReason.FOCUS))
 			if self.itemType == "formField":
-				if role in (controlTypes.ROLE_BUTTON,controlTypes.ROLE_DROPDOWNBUTTON,controlTypes.ROLE_TOGGLEBUTTON,controlTypes.ROLE_SPLITBUTTON,controlTypes.ROLE_MENUBUTTON,controlTypes.ROLE_DROPDOWNBUTTONGRID,controlTypes.ROLE_SPINBUTTON,controlTypes.ROLE_TREEVIEWBUTTON):
+				if role in (
+					controlTypes.ROLE_BUTTON,
+					controlTypes.ROLE_DROPDOWNBUTTON,
+					controlTypes.ROLE_TOGGLEBUTTON,
+					controlTypes.ROLE_SPLITBUTTON,
+					controlTypes.ROLE_MENUBUTTON,
+					controlTypes.ROLE_DROPDOWNBUTTONGRID,
+					controlTypes.ROLE_TREEVIEWBUTTON
+				):
 					# Example output: Mute; toggle button; pressed
 					labelParts = (content or name or unlabeled, roleText, labeledStates)
 				else:


Test patch: