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

[TwigBridge] Allow floats in html5 input type number field #48965

Merged
merged 1 commit into from Feb 23, 2023

Conversation

wimhendrikx
Copy link
Contributor

@wimhendrikx wimhendrikx commented Jan 12, 2023

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets
License MIT
Doc PR

Adding the attribute step: any allows for correct use of floats in number input

@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has a contribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (see https://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (see https://symfony.com/releases)
  • Features and deprecations must be submitted against the 6.3 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@carsonbot carsonbot changed the title Use correct input type for number widget [TwigBridge] Use correct input type for number widget Jan 13, 2023
@nicolas-grekas
Copy link
Member

Can you please have a look a failing tests?

Copy link
Member

@xabbuh xabbuh left a comment

Choose a reason for hiding this comment

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

This does not work with localized numbers, does it? At least from what I see the arrows rendered by the browser will change the format of the rendered values.

@wimhendrikx
Copy link
Contributor Author

Hi @xabbuh ,

It changes the format to the used locale notation. For me it keeps , and changes . to , like it should.

@wimhendrikx
Copy link
Contributor Author

Hi @nicolas-grekas,

I fixed the issues in the tests and now it works for 7.2, 7.4 and 8.2 but not for 8.0 and 8.2. Any idea how I can fix it for the other 2?

Copy link
Member

@yceruto yceruto left a comment

Choose a reason for hiding this comment

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

It works well on my side too.

@esserj
Copy link

esserj commented Jan 19, 2023

isn't this contradicting the html5 option of the NumberType

#\Symfony\Component\Form\Extension\Core\Type\NumberType
    public function buildView(FormView $view, FormInterface $form, array $options)
    {
        if ($options['html5']) {
            $view->vars['type'] = 'number';
        }
    }

The default is assuming the same default as the Type is, html5 is false by default, and thus is opted for text instead?

@wimhendrikx
Copy link
Contributor Author

@esserj , thanks for pointing that out. That option is not needed anymore so I will remove it.

@wimhendrikx
Copy link
Contributor Author

I'm gonna change this PR and put the steps: any attribute in the html5 option. This way it is fully BC.

@wimhendrikx wimhendrikx changed the title [TwigBridge] Use correct input type for number widget [TwigBridge] Allow floats in html5 input type number field Jan 21, 2023
@wimhendrikx wimhendrikx requested review from xabbuh, yceruto and nicolas-grekas and removed request for xabbuh and yceruto January 21, 2023 15:43
@nicolas-grekas
Copy link
Member

Thank you @wimhendrikx.

@nicolas-grekas nicolas-grekas merged commit e364f02 into symfony:5.4 Feb 23, 2023
9 of 11 checks passed
This was referenced Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants