@@ -165,30 +165,27 @@ const ObjectPageTitle = forwardRef<HTMLDivElement, ObjectPageTitlePropTypes>((pr
165165 useEffect ( ( ) => {
166166 const toolbarContainer = toolbarContainerRef . current ;
167167
168- const observer = new MutationObserver ( ( [ toolbarContainerMutation ] ) => {
169- if ( toolbarContainerMutation . type === 'childList' ) {
170- const navigationToolbar : ToolbarDomRef | undefined = (
171- toolbarContainerMutation . target as HTMLDivElement
172- ) . querySelector ( ':has(> :nth-last-child(n + 2)) > [ui5-toolbar]:last-child' ) ;
173- if ( navigationToolbar ?. children ) {
174- Array . from ( navigationToolbar . children ) . forEach ( ( item ) => {
168+ const updateNavigationToolbar = ( container : HTMLDivElement ) => {
169+ if ( container . children . length >= 2 ) {
170+ const lastChild = container . lastElementChild as ToolbarDomRef ;
171+ if ( lastChild && lastChild . matches ( '[ui5-toolbar]' ) ) {
172+ Array . from ( lastChild . children ) . forEach ( ( item ) => {
175173 item . setAttribute ( 'overflow-priority' , 'NeverOverflow' ) ;
176174 } ) ;
177175 }
178176 }
177+ } ;
178+
179+ const observer = new MutationObserver ( ( [ toolbarContainerMutation ] ) => {
180+ if ( toolbarContainerMutation . type === 'childList' ) {
181+ updateNavigationToolbar ( toolbarContainerMutation . target as HTMLDivElement ) ;
182+ }
179183 } ) ;
180184
181185 const config = { childList : true , subtree : true } ;
182186
183187 if ( toolbarContainer ) {
184- const navigationToolbar : ToolbarDomRef | undefined = toolbarContainer . querySelector (
185- ':has(> :nth-last-child(n + 2)) > [ui5-toolbar]:last-child'
186- ) ;
187- if ( navigationToolbar ?. children ) {
188- Array . from ( navigationToolbar . children ) . forEach ( ( item ) => {
189- item . setAttribute ( 'overflow-priority' , 'NeverOverflow' ) ;
190- } ) ;
191- }
188+ updateNavigationToolbar ( toolbarContainer ) ;
192189 observer . observe ( toolbarContainer , config ) ;
193190 }
194191
@@ -243,7 +240,7 @@ const ObjectPageTitle = forwardRef<HTMLDivElement, ObjectPageTitlePropTypes>((pr
243240 { actionsBar }
244241 { ! showNavigationInTopArea && actionsBar && navigationBar && (
245242 < div
246- className = { classNames . actionsSpacer }
243+ className = { classNames . actionsSeparator }
247244 data-component-name = "ObjectPageTitleActionsSeparator"
248245 aria-hidden
249246 />
0 commit comments