Skip to content

Commit 5bc035b

Browse files
authored
Allow option disabling for optgroup binding
The optgroup Knockout binding formats its options before usage in the optionsAfterRender of the form/element/select.html knockout template. In this process all extra data of the options will be stripped and the optionsAfterRenderer cannot access the disabled value of any option. Because of this the delimiter option in the country_id select in checkout is choosable by the customer.
1 parent 10c6ffa commit 5bc035b

File tree

1 file changed

+5
-0
lines changed
  • app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings

1 file changed

+5
-0
lines changed

app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/optgroup.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,15 @@ define([
297297
ko.utils.arrayForEach(options, function (option) {
298298
var value = applyToObject(option, optionsValue, option),
299299
label = applyToObject(option, optionsText, value) || '',
300+
disabled = applyToObject(option, 'disabled', false) || false,
300301
obj = {},
301302
space = '\u2007\u2007\u2007';
302303

303304
obj[optionTitle] = applyToObject(option, optionsText + 'title', value);
305+
306+
if(disabled) {
307+
obj['disabled'] = disabled;
308+
}
304309

305310
label = label.replace(nbspRe, '').trim();
306311

0 commit comments

Comments
 (0)