Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add KFocusTrap and use it in Kmodal #764

Closed
wants to merge 13 commits into from
15 changes: 15 additions & 0 deletions lib/KRadioButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@
"KRadioButton: 'value' prop is deprecated and will be removed in a future release. Please use 'buttonValue' instead."
);
}
if (process.env.NODE_ENV !== 'production') {
this.checkForKRadioButtonGroup();
}
},
methods: {
/**
Expand Down Expand Up @@ -237,6 +240,18 @@
setTabIndex(val) {
this.tabIndex = val;
},

checkForKRadioButtonGroup() {
let parent = this.$parent;
while (parent) {
if (parent.$options.name === 'KRadioButtonGroup') {
return; // Found KRadioButtonGroup, no warning needed
}
parent = parent.$parent;
}
// If we get here, no KRadioButtonGroup was found
console.warn('KRadioButton should be nested inside a KRadioButtonGroup component.');
},
},
};

Expand Down