Mobile: mWizard: disabled input fields: make sure both image and spinfield controls do not stay active

And make sure the js listener is only added when the inputfield is enabled (fixing useless callbacks and changes on html)

Change-Id: I4f4f2b4430b1c43143f95ab9d9fe075c8e1f49b8
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92763
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Pedro Pinto da Silva <pedro.silva@collabora.com>
Reviewed-by: Pedro Pinto da Silva <pedro.silva@collabora.com>
This commit is contained in:
Pedro Pinto Silva 2020-04-23 14:11:42 +02:00 committed by Pedro Pinto da Silva
parent 15c2235d16
commit 8f05c15656
2 changed files with 24 additions and 10 deletions

View file

@ -540,8 +540,11 @@ input.spinfield:disabled ~ .spinfieldcontrols * {
background-color: #f9f9f9;
}
input.spinfield:disabled ~ .spinfieldcontrols *:active {
input.spinfield:disabled ~ .spinfieldcontrols *:active, input.spinfield:disabled ~ .spinfieldcontrols *:hover, input.spinfield:disabled ~ .spinfieldcontrols *:focus {
background-color: #f9f9f9 !important;
filter: none;
font-size: 100%;
font-weight: normal;
}
/*insert table special layout*/
@ -701,6 +704,9 @@ div#mobile-wizard-content .spinfieldcontainer .spinfieldimage {
div#mobile-wizard-content .spinfieldcontainer:active .spinfieldimage, div#mobile-wizard-content .spinfieldcontainer:focus .spinfieldimage, div#mobile-wizard-content .spinfieldcontainer:hover .spinfieldimage {
opacity: 1 !important;
}
div#mobile-wizard-content .spinfieldcontainer .spinfieldimage.disabled {
opacity: 0.5 !important;
}
#buttonbefore, #buttonafter, #buttonoptimal, #buttonparallel, #buttonnone, #buttonthrough, #bottom, #top, #standard, #Bold, #Italic, #Underline, #Strikeout{
margin: 0;
padding: 0;

View file

@ -1044,8 +1044,10 @@ L.Control.JSDialogBuilder = L.Control.extend({
if (data.max != undefined)
$(spinfield).attr('max', data.max);
if (data.enabled == 'false')
if (data.enabled == 'false') {
$(spinfield).attr('disabled', 'disabled');
$(image).addClass('disabled');
}
if (data.readOnly === true)
$(spinfield).attr('readOnly', 'true');
@ -1081,17 +1083,23 @@ L.Control.JSDialogBuilder = L.Control.extend({
});
plus.addEventListener('click', function() {
if (customCallback)
customCallback('spinfield', 'plus', div, this.value, builder);
else
builder.callback('spinfield', 'plus', div, this.value, builder);
var attrdisabled = $(spinfield).attr('disabled');
if (attrdisabled !== 'disabled') {
if (customCallback)
customCallback('spinfield', 'plus', div, this.value, builder);
else
builder.callback('spinfield', 'plus', div, this.value, builder);
}
});
minus.addEventListener('click', function() {
if (customCallback)
customCallback('spinfield', 'minus', div, this.value, builder);
else
builder.callback('spinfield', 'minus', div, this.value, builder);
var attrdisabled = $(spinfield).attr('disabled');
if (attrdisabled !== 'disabled') {
if (customCallback)
customCallback('spinfield', 'minus', div, this.value, builder);
else
builder.callback('spinfield', 'minus', div, this.value, builder);
}
});
if (data.hidden)