Fixed #5289 - Menu components hover and visual focus updates

styled-props-system
tugcekucukoglu 2024-02-15 19:01:09 +03:00
parent b927c604d3
commit c01a99e48e
1 changed files with 15 additions and 4 deletions

View File

@ -283,13 +283,24 @@ export default {
const { index, level, parentKey, children } = processedOption;
const grouped = ObjectUtils.isNotEmpty(children);
const root = ObjectUtils.isEmpty(processedOption.parent);
const selected = this.isSelected(processedOption);
const activeOptionPath = this.activeOptionPath.filter((p) => p.parentKey !== parentKey);
if (selected) {
const { index, key, level, parentKey } = processedOption;
activeOptionPath.push(processedOption);
this.focusedOptionInfo = { index, level, parentKey };
this.activeOptionPath = this.activeOptionPath.filter((p) => key !== p.key && key.startsWith(p.key));
this.focusedOptionInfo = { index, level, parentKey };
this.activeOptionPath = activeOptionPath;
this.dirty = !root;
} else {
const activeOptionPath = this.activeOptionPath.filter((p) => p.parentKey !== parentKey);
activeOptionPath.push(processedOption);
this.focusedOptionInfo = { index, level, parentKey };
this.activeOptionPath = activeOptionPath;
}
grouped ? this.onOptionGroupSelect(originalEvent, processedOption) : this.onOptionSelect(originalEvent, processedOption, isHide);
isFocus && DomHandler.focus(this.$refs.focusInput);