mirror of
https://github.com/abapGit/abapGit.git
synced 2025-05-01 12:20:51 +08:00
LinkHints: enable radio button (#5656)
This commit is contained in:
parent
d145837d96
commit
7f80845308
|
@ -1474,8 +1474,10 @@ LinkHints.prototype.hintActivate = function (hint) {
|
||||||
this.activatedDropdown = hint.parent.parentElement;
|
this.activatedDropdown = hint.parent.parentElement;
|
||||||
this.activatedDropdown.classList.toggle("force-nav-hover");
|
this.activatedDropdown.classList.toggle("force-nav-hover");
|
||||||
hint.parent.focus();
|
hint.parent.focus();
|
||||||
} else if (hint.parent.type === "checkbox" || hint.parent.type === "radio") {
|
} else if (hint.parent.type === "checkbox") {
|
||||||
this.toggleCheckbox(hint);
|
this.toggleCheckbox(hint);
|
||||||
|
} else if (hint.parent.type === "radio") {
|
||||||
|
this.toggleRadioButton(hint);
|
||||||
} else if (hint.parent.type === "submit") {
|
} else if (hint.parent.type === "submit") {
|
||||||
hint.parent.click();
|
hint.parent.click();
|
||||||
} else if (hint.parent.nodeName === "INPUT" || hint.parent.nodeName === "TEXTAREA") {
|
} else if (hint.parent.nodeName === "INPUT" || hint.parent.nodeName === "TEXTAREA") {
|
||||||
|
@ -1487,18 +1489,26 @@ LinkHints.prototype.hintActivate = function (hint) {
|
||||||
};
|
};
|
||||||
|
|
||||||
LinkHints.prototype.toggleCheckbox = function (hint) {
|
LinkHints.prototype.toggleCheckbox = function (hint) {
|
||||||
// ensures that onclick handler is executed
|
|
||||||
// https://stackoverflow.com/questions/41981509/trigger-an-event-when-a-checkbox-is-changed-programmatically-via-javascript
|
|
||||||
var event = document.createEvent("HTMLEvents");
|
|
||||||
var checked = hint.parent.checked;
|
var checked = hint.parent.checked;
|
||||||
event.initEvent("click", false, true);
|
this.triggerClickHandler(hint.parent.parentElement);
|
||||||
hint.parent.parentElement.dispatchEvent(event);
|
|
||||||
if (checked === hint.parent.checked) {
|
if (checked === hint.parent.checked) {
|
||||||
// fallback if no handler is registered
|
// fallback if no handler is registered
|
||||||
hint.parent.checked = !hint.parent.checked;
|
hint.parent.checked = !hint.parent.checked;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
LinkHints.prototype.toggleRadioButton = function(hint) {
|
||||||
|
this.triggerClickHandler(hint.parent);
|
||||||
|
};
|
||||||
|
|
||||||
|
LinkHints.prototype.triggerClickHandler = function(el){
|
||||||
|
// ensures that onclick handler is executed
|
||||||
|
// https://stackoverflow.com/questions/41981509/trigger-an-event-when-a-checkbox-is-changed-programmatically-via-javascript
|
||||||
|
var event = document.createEvent("HTMLEvents");
|
||||||
|
event.initEvent("click", false, true);
|
||||||
|
el.dispatchEvent(event);
|
||||||
|
};
|
||||||
|
|
||||||
LinkHints.prototype.filterHints = function () {
|
LinkHints.prototype.filterHints = function () {
|
||||||
var visibleHints = 0;
|
var visibleHints = 0;
|
||||||
for (var i = this.hintsMap.first; i <= this.hintsMap.last; i++) {
|
for (var i = this.hintsMap.first; i <= this.hintsMap.last; i++) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user