Commit graph

12 commits

Author SHA1 Message Date
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
Sébastien Beyou 253eb5e85a Replace use of deprecated $.debounce()
Bug: T213426
Change-Id: I1502a1bd68ea260e94a47fcce047bafce3e47f0b
2021-04-30 00:49:27 +00:00
Fomafix 67f4de2288 Switch from jshint to eslint
Change-Id: I4401103dce2ee1558365f46b62a86689521c58a9
2018-08-28 21:16:54 +02:00
Umherirrender 7f0c04f2b0 Add stylelint for css files
Fixed the following rule:
no-missing-end-of-source-newline

Change-Id: I0ba2e411279a101870c89b733dc9315be525c937
2017-04-17 22:40:02 +02:00
Kunal Mehta 5a03081a98 Set license-name to "MIT-Licence"
Follows-up d5dbe717b, which accidentally lost all licensing information.

Bug: T106642
Change-Id: I44024a0041040bbff42afceb650170af1d0b6c66
2015-08-24 00:39:42 +05:30
Florian 50b015d7fe Add space between input fields and buttons
It looks strange, if the button is directly after the input field
without any space.

Change-Id: I6435df75253080b68164415b354248ace2bbaede
2015-07-11 22:34:45 +00:00
glaisher ddf6329103 Make createboxButton disabling work again
'createboxButton' class was erroneously removed in Ia608324703987371
so add it back again. Also prefixed "inputbox-element" class with
a "mw-" for consitency as well.

Bug: T92611
Change-Id: I36718671e6012427a647de7a1cc712e3c8394ee1
2015-03-21 13:40:47 +05:00
Florianschmidtwelzow 99277a4d0f Hygiene: Use MediaWiki-UI for all elements
For checkboxes and text input fields, not only for buttons.

Fix missing space between input and submit button in search2, too.

Follow up: Ia608324703987371aa66beccbac962024fc6e897

Bug: T63526
Change-Id: Id9fb22885b836c0dfe6a086e2ec45e2018244210
2015-02-23 09:47:05 +01:00
Bartosz Dziewoński 1a257d5a52 Don't expect input in hidden text fields
Bug: 72235
Change-Id: I93e2b835b554275c9a871883240e9fd45d33f3d8
2014-10-19 17:35:43 +02:00
Marius Hoch b71189cffe Improve initialization of ext.inputBox.js
Change-Id: I45b6a6106ece16f069907076a8f1f635d95fd2df
2014-10-05 19:03:05 +02:00
tonythomas01 7096213874 Adding a JS Class to inputBox to grey out Submit button.
If the user does not enter a title in the <inputbox> for type=create
and hits the submit button, it opens the Main page for editing (or
view-source) due to empty title= param in URL. Greying out the submit
button until user enters the title solves the issue.

Bug: 61606
Bug: 62975
Change-Id: I5c6c34b90c6c499ef7cb96ad8d47fdbbcbbcd8a8
2014-10-04 13:35:42 +00:00
Derk-Jan Hartman d05173bdd2 InputBox: Cleanup usage of inline styles
Change-Id: I2e1384e1f46e8592ecba7bbfea81884804f0128a
2014-05-18 11:51:07 +02:00