1- import { ariaHidden } from "@zag-js/aria-hidden"
21import { setup } from "@zag-js/core"
32import { trackDismissableElement } from "@zag-js/dismissable"
43import { clickIfLink , nextTick , observeAttributes , raf , scrollIntoView , setCaretToEnd } from "@zag-js/dom-query"
@@ -350,7 +349,7 @@ export const machine = createMachine({
350349 interacting : {
351350 tags : [ "open" , "focused" ] ,
352351 entry : [ "setInitialFocus" ] ,
353- effects : [ "scrollToHighlightedItem" , "trackDismissableLayer" , "trackPlacement" , "hideOtherElements" ] ,
352+ effects : [ "scrollToHighlightedItem" , "trackDismissableLayer" , "trackPlacement" ] ,
354353 on : {
355354 "CONTROLLED.CLOSE" : [
356355 {
@@ -526,7 +525,7 @@ export const machine = createMachine({
526525
527526 suggesting : {
528527 tags : [ "open" , "focused" ] ,
529- effects : [ "trackDismissableLayer" , "scrollToHighlightedItem" , "trackPlacement" , "hideOtherElements" ] ,
528+ effects : [ "trackDismissableLayer" , "scrollToHighlightedItem" , "trackPlacement" ] ,
530529 entry : [ "setInitialFocus" ] ,
531530 on : {
532531 "CONTROLLED.CLOSE" : [
@@ -696,7 +695,10 @@ export const machine = createMachine({
696695 if ( isBoolean ( openOnChange ) ) return openOnChange
697696 return ! ! openOnChange ?.( { inputValue : context . get ( "inputValue" ) } )
698697 } ,
699- restoreFocus : ( { event } ) => ( event . restoreFocus == null ? true : ! ! event . restoreFocus ) ,
698+ restoreFocus : ( { event } ) => {
699+ const restoreFocus = event . restoreFocus ?? event . previousEvent ?. restoreFocus
700+ return restoreFocus == null ? true : ! ! restoreFocus
701+ } ,
700702 isChangeEvent : ( { event } ) => event . previousEvent ?. type === "INPUT.CHANGE" ,
701703 autoFocus : ( { prop } ) => ! ! prop ( "autoFocus" ) ,
702704 isHighlightedItemRemoved : ( { prop, context } ) => ! prop ( "collection" ) . has ( context . get ( "highlightedValue" ) ) ,
@@ -723,14 +725,6 @@ export const machine = createMachine({
723725 } ,
724726 } )
725727 } ,
726- hideOtherElements ( { scope } ) {
727- return ariaHidden ( [
728- dom . getInputEl ( scope ) ,
729- dom . getContentEl ( scope ) ,
730- dom . getTriggerEl ( scope ) ,
731- dom . getClearTriggerEl ( scope ) ,
732- ] )
733- } ,
734728 trackPlacement ( { context, prop, scope } ) {
735729 const anchorEl = ( ) => dom . getControlEl ( scope ) || dom . getTriggerEl ( scope )
736730 const positionerEl = ( ) => dom . getPositionerEl ( scope )
0 commit comments