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

NumberBox's Input TextBox's InputScope should be set to "Number" #1912

Closed
robloo opened this issue Jan 30, 2020 · 10 comments · Fixed by #2605
Closed

NumberBox's Input TextBox's InputScope should be set to "Number" #1912

robloo opened this issue Jan 30, 2020 · 10 comments · Fixed by #2605
Assignees
Labels
area-NumberBox NumberBox Control bug Something isn't working team-Controls Issue for the Controls team

Comments

@robloo
Copy link
Contributor

robloo commented Jan 30, 2020

Proposal: Set NumberBox's Input TextBox's InputScope="Number"

The current NumberBox ControlTemplate does not set the "InputBox" TextBox's InputScope. This means the system will handle it using defaults. It's better to add InputScope="Number" in XAML to ensure the system will handle numerical entry better within the NumberBox. This is especially helpful for virtual keyboards on the desktop and mobile.

Summary

In the code here

<TextBox x:Name="InputBox"
    Grid.Column="0"
    Header="{TemplateBinding Header}"
    HeaderTemplate="{TemplateBinding HeaderTemplate}"
    PlaceholderText="{TemplateBinding PlaceholderText}"
    contract7Present:SelectionFlyout="{TemplateBinding SelectionFlyout}"
    SelectionHighlightColor="{TemplateBinding SelectionHighlightColor}"
    TextReadingOrder="{TemplateBinding TextReadingOrder}"
    PreventKeyboardDisplayOnProgrammaticFocus="{TemplateBinding PreventKeyboardDisplayOnProgrammaticFocus}"
    contract7Present:Description="{TemplateBinding Description}"/>

Simply add a new property to the TextBox

InputScope="Number"

This is documented in UWP for the TextBox here and generically here and don't forget the InputScopeNameValue Enum

Rationale

Better handing of the NumberBox by the system especially with virtual keyboards.

@robloo robloo added the feature proposal New feature proposal label Jan 30, 2020
@msft-github-bot msft-github-bot added the needs-triage Issue needs to be triaged by the area owners label Jan 30, 2020
@robloo
Copy link
Contributor Author

robloo commented Jan 30, 2020

@SavoySchuler @teaP This is an easy one that is a nice-to-have for the NumberBox. If you agree with the concept, I would like to submit the PR myself.

@mdtauk
Copy link
Contributor

mdtauk commented Jan 30, 2020

The one issue about setting it to number, is when the common scenario is to do calculations which require operators and brackets - so this InputScope should be overridable.

@robloo
Copy link
Contributor Author

robloo commented Jan 30, 2020

@mdtauk I don't think this is an issue. I checked and the standard number keyboard has mathematical operators and parenthesis as well. This is true for the touch keyboard on mobile devices at least -- I can't seem to get the keyboard to change on Windows 10 desktop (which means it would show the full keyboard anyway).

<TextBox InputScope="Number"/>

number

See:
https://docs.microsoft.com/en-us/windows/uwp/design/input/use-input-scope-to-change-the-touch-keyboard

@StephenLPeters StephenLPeters added area-NumberBox NumberBox Control team-Controls Issue for the Controls team and removed needs-triage Issue needs to be triaged by the area owners labels Jan 31, 2020
@StephenLPeters
Copy link
Contributor

Great suggestion! @robloo I'll assign the issue to you and you can submit your fix? :)

@robloo
Copy link
Contributor Author

robloo commented Jan 31, 2020

Sure! Will be a few days before I get around to it, but will be happy to submit the PR.

@SavoySchuler SavoySchuler assigned SavoySchuler and unassigned robloo Feb 15, 2020
@SavoySchuler
Copy link
Member

SavoySchuler commented Feb 19, 2020

I believe this is not a proposal, but a bug as NumberBox's spec notes here that "Number" should be the InputScope of NumberBox: https://github.com/microsoft/microsoft-ui-xaml-specs/blob/master/active/NumberBox/NumberBox.md#input-scope

@teaP if there was a reason for this change that I forgot to note in the spec, please let me know. I'll turn this over to you unless I am otherwise needed, but it sounds like @robloo may also already have the code fix we need! 😄

Thanks for filing this @robloo and for putting the work in to fix it! You rock!

@SavoySchuler SavoySchuler assigned teaP and unassigned SavoySchuler Feb 19, 2020
@SavoySchuler SavoySchuler added bug Something isn't working and removed feature proposal New feature proposal labels Feb 19, 2020
@SavoySchuler SavoySchuler changed the title Proposal: Set NumberBox's Input TextBox's InputScope="Number" NumberBox's Input TextBox's InputScope should be set to "Number" Feb 19, 2020
@robloo
Copy link
Contributor Author

robloo commented Mar 3, 2020

I should get to this next week. @teaP please let me know if there was a reason it wasn't already done.

@marcelwgn
Copy link
Collaborator

@robloo Would you like to add the inputscope or would you mind me creating a PR for this quickly?

@robloo
Copy link
Contributor Author

robloo commented Apr 18, 2020

@chingucoding Thanks for the reminder. I would rather keep this assigned to me and I'll finish it soon. It's an easy one but it will force me to setup the dev environment and read through the contribution docs. This will make future contributions easier.

@marcelwgn
Copy link
Collaborator

Okay, sure @robloo . If you need help with setting up the environment or if you have troubles compiling, feel free to ask :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-NumberBox NumberBox Control bug Something isn't working team-Controls Issue for the Controls team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants