mirror of
https://we.phorge.it/source/phorge.git
synced 2025-03-28 04:00:17 +01:00
Summary: Fixes T11365. I tested these variants: - `<input type="number" />` - `<input type="text" pattern="\d*" />` Of these, this one (using `pattern`) appears to have the best behavior: it shows the correct keyboard on iOS mobile and does nothing on desktops. Using `type="number"` causes unwanted sub-controls to appear in desktop Safari, and a numbers + symbols keyboard to appear on iOS (presumably so users can type "." and "-" and maybe ","). Test Plan: Tested variants in desktop browsers and iOS simulator, see here and T11365 for discussion. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11365 Differential Revision: https://secure.phabricator.com/D16323
22 lines
484 B
PHP
22 lines
484 B
PHP
<?php
|
|
|
|
final class PHUIFormNumberControl extends AphrontFormControl {
|
|
|
|
protected function getCustomControlClass() {
|
|
return 'phui-form-number';
|
|
}
|
|
|
|
protected function renderInput() {
|
|
return javelin_tag(
|
|
'input',
|
|
array(
|
|
'type' => 'text',
|
|
'pattern' => '\d*',
|
|
'name' => $this->getName(),
|
|
'value' => $this->getValue(),
|
|
'disabled' => $this->getDisabled() ? 'disabled' : null,
|
|
'id' => $this->getID(),
|
|
));
|
|
}
|
|
|
|
}
|