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

Enable input number component to support type='range' attribute #55583

Conversation

MattyLeslie
Copy link
Contributor

Enable input number component to support type='range' attribute

Summary of the changes

  1. Modified the InputNumber component to allow the 'type' attribute specified by the user to take precedence over the default 'type="number"'. By swapping the order in which attributes are added to the builder, any user-defined 'type' attribute is now respected, enabling the usage of different input types like 'range'.

  2. Added a unit test to InputNumberTests to ensure the user defined type attribute overrides the default

Fixes #52067 by ensuring the type of the InputNumber component can be specified.

MattyLeslie and others added 3 commits May 7, 2024 09:55
…te specified by the user to take precedence over the default 'type="number"'. By swapping the order in which attributes are added to the builder, any user-defined 'type' attribute is now respected, enabling the usage of different input types like 'range'.

Previously, the InputNumber component hardcoded the 'type' attribute as 'number', which prevented using it for other input types such as sliders (range inputs).
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label May 7, 2024
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label May 7, 2024
@mkArtakMSFT mkArtakMSFT assigned javiercn and MackinnonBuck and unassigned javiercn May 8, 2024
@MattyLeslie MattyLeslie marked this pull request as ready for review May 20, 2024 18:24
@MattyLeslie MattyLeslie requested a review from a team as a code owner May 20, 2024 18:24
@dotnet-policy-service dotnet-policy-service bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label May 27, 2024
Copy link

Commenter does not have sufficient privileges for PR 55583 in repo dotnet/aspnetcore

@javiercn
Copy link
Member

/azp run aspnetcore-ci

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@MattyLeslie
Copy link
Contributor Author

@MackinnonBuck, may I please request a review on this.

Copy link
Member

@MackinnonBuck MackinnonBuck left a comment

Choose a reason for hiding this comment

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

Thanks for working on this, @MattyLeslie!

The framework change looks good - I've just added some comments about the test code 🙂

src/Components/Web/test/Forms/InputNumberTest.cs Outdated Show resolved Hide resolved
src/Components/Web/test/Forms/InputNumberTest.cs Outdated Show resolved Hide resolved
src/Components/Web/test/Forms/InputNumberTest.cs Outdated Show resolved Hide resolved
src/Components/Web/test/Forms/InputNumberTest.cs Outdated Show resolved Hide resolved
Copy link
Member

@MackinnonBuck MackinnonBuck left a comment

Choose a reason for hiding this comment

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

This looks great, thank you @MattyLeslie! 🎉

src/Components/Web/test/Forms/InputNumberTest.cs Outdated Show resolved Hide resolved
@MackinnonBuck MackinnonBuck merged commit f739b49 into dotnet:main Jul 26, 2024
26 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the 9.0-rc1 milestone Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components community-contribution Indicates that the PR has been added by a community member pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add an inputRange component like the basic inputNumber components
3 participants