Go to file
Timo Tijhof 93351fb7d9 Use native <input required> instead of JS-based disabled toggling
Remove the JavaScript module and its logic to toggle the disabled
state on the submit button. Instead, let the browser handle this
natively by setting the `required` attribute, which naturally prevents
early submissions.

Retain the current styling for 99% of cases by using the
:required:invalid selector to target the submit button to make it
appear disabled. This slight duplication of styles is needed because,
despite the form effectively being disabled natively, the core
mediawiki-ui styles only account for :disabled on the button directly
and not e.g. inherited via form:invalid. It is also unclear whether
we would want that, since there is some value to be had from having
the form give a consistent look with a progressive button that can
be submitted even at the wrong time to yield an assistive message to
the required field, so hence handling this locally for now instead of
with a generalised approach.

In order to use the required true/false idiom, I have switched the
generating of the HTML string from the old Xml::element method
to Html::element. This means there is no need to store it in an array
first and conditionally set it since true/false will result in absence
or required="" as needed.

As side-effect from this, redundant attributes like value="" and
type="text" are ommitted from the output, just as MediaWiki core does
more generally.

Bug: T283303
Change-Id: I2c75e09dd3f89fa11fca311b4e1f8133946b01b1
2021-05-21 21:04:02 +01:00
.phan Upgrade InputBox extension to use newer phan 2019-03-02 21:02:16 +01:00
i18n Localisation updates from https://translatewiki.net. 2021-05-19 08:43:09 +02:00
includes Use native <input required> instead of JS-based disabled toggling 2021-05-21 21:04:02 +01:00
resources Use native <input required> instead of JS-based disabled toggling 2021-05-21 21:04:02 +01:00
tests/parser Use native <input required> instead of JS-based disabled toggling 2021-05-21 21:04:02 +01:00
.eslintrc.json Use native <input required> instead of JS-based disabled toggling 2021-05-21 21:04:02 +01:00
.gitignore build: Updating npm dependencies for security issues 2019-06-08 12:09:25 +00:00
.gitreview Whoops, track not trace 2016-10-24 17:02:45 -07:00
.phpcs.xml build: Updating mediawiki/mediawiki-codesniffer to 33.0.0 2020-11-04 02:06:23 +00:00
.stylelintrc.json Use json extension for .stylelintrc 2017-08-19 09:49:33 +02:00
CODE_OF_CONDUCT.md build: Updating mediawiki/phan-taint-check-plugin to 1.3.0 2018-08-19 13:29:12 +00:00
composer.json build: Updating composer dependencies 2021-05-05 03:57:17 +00:00
COPYING Provide missing COPYING file 2016-03-10 14:58:24 +01:00
extension.json Use native <input required> instead of JS-based disabled toggling 2021-05-21 21:04:02 +01:00
Gruntfile.js build: Updating dependencies 2021-01-29 21:32:48 +00:00
package-lock.json build: Updating npm dependencies 2021-05-11 02:05:54 +00:00
package.json build: Updating npm dependencies 2021-05-11 02:05:54 +00:00