11import  $  from  'jquery' ; 
22import  type  { FomanticInitFunction }  from  '../../types.ts' ; 
3- import  { generateUniqueId ,  queryElems }  from  '../../utils/dom.ts' ; 
3+ import  { generateElemId ,  queryElems }  from  '../../utils/dom.ts' ; 
44
55const  ariaPatchKey  =  '_giteaAriaPatchDropdown' ; 
66const  fomanticDropdownFn  =  $ . fn . dropdown ; 
@@ -46,7 +46,7 @@ function ariaDropdownFn(this: any, ...args: Parameters<FomanticInitFunction>) {
4646// make the item has role=option/menuitem, add an id if there wasn't one yet, make items as non-focusable 
4747// the elements inside the dropdown menu item should not be focusable, the focus should always be on the dropdown primary element. 
4848function  updateMenuItem ( dropdown : HTMLElement ,  item : HTMLElement )  { 
49-   if  ( ! item . id )  item . id  =  generateUniqueId ( '_aria_dropdown_item_' ) ; 
49+   if  ( ! item . id )  item . id  =  generateElemId ( '_aria_dropdown_item_' ) ; 
5050  item . setAttribute ( 'role' ,  ( dropdown  as  any ) [ ariaPatchKey ] . listItemRole ) ; 
5151  item . setAttribute ( 'tabindex' ,  '-1' ) ; 
5252  for  ( const  el  of  item . querySelectorAll ( 'a, input, button' ) )  el . setAttribute ( 'tabindex' ,  '-1' ) ; 
@@ -58,7 +58,7 @@ function updateMenuItem(dropdown: HTMLElement, item: HTMLElement) {
5858function  updateSelectionLabel ( label : HTMLElement )  { 
5959  // the "label" is like this: "<a|div class="ui label" data-value="1">the-label-name <i|svg class="delete icon"/></a>" 
6060  if  ( ! label . id )  { 
61-     label . id  =  generateUniqueId ( '_aria_dropdown_label_' ) ; 
61+     label . id  =  generateElemId ( '_aria_dropdown_label_' ) ; 
6262  } 
6363  label . tabIndex  =  - 1 ; 
6464
@@ -126,7 +126,7 @@ function delegateDropdownModule($dropdown: any) {
126126function  attachStaticElements ( dropdown : HTMLElement ,  focusable : HTMLElement ,  menu : HTMLElement )  { 
127127  // prepare static dropdown menu list popup 
128128  if  ( ! menu . id )  { 
129-     menu . id  =  generateUniqueId ( '_aria_dropdown_menu_' ) ; 
129+     menu . id  =  generateElemId ( '_aria_dropdown_menu_' ) ; 
130130  } 
131131
132132  $ ( menu ) . find ( '> .item' ) . each ( ( _ ,  item )  =>  updateMenuItem ( dropdown ,  item ) ) ; 
0 commit comments