Skip to content

Commit

Permalink
fix(select): observable for label change (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
aesteves60 authored Nov 21, 2023
1 parent c780d57 commit 272075b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ export class OsdsSelect implements OdsSelectAttribute, OdsSelectEvent, OdsSelect

setSelectOptions() {
this.controller.selectOptions = this.getSelectOptionList();
this.controller.selectOptions.forEach((option) => this.observer?.observe(option, { childList: true }));
this.controller.selectOptions.forEach((option) => this.observer?.observe(option, { childList: true, attributes: true, subtree: true }));
}

getSelectOptionList(): (HTMLElement & OsdsSelectOption)[] {
Expand Down
4 changes: 4 additions & 0 deletions packages/components/select/src/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ export default function() {

(window as any).select1Toggle = function(/*evt: Event*/) {
logger.log('select1Toggle');
const options = document.querySelectorAll('#select1 > osds-select-option');
options.forEach((option) => {
option.innerHTML = `NewValue${option.getAttribute('value')}`;
});
// todo
// examples.select1.component && (examples.select1.component.opened = !examples.select1.component.opened);
// evt.stopPropagation()
Expand Down

0 comments on commit 272075b

Please sign in to comment.