@@ -165,30 +165,27 @@ const ObjectPageTitle = forwardRef<HTMLDivElement, ObjectPageTitlePropTypes>((pr
165
165
useEffect ( ( ) => {
166
166
const toolbarContainer = toolbarContainerRef . current ;
167
167
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 ) => {
175
173
item . setAttribute ( 'overflow-priority' , 'NeverOverflow' ) ;
176
174
} ) ;
177
175
}
178
176
}
177
+ } ;
178
+
179
+ const observer = new MutationObserver ( ( [ toolbarContainerMutation ] ) => {
180
+ if ( toolbarContainerMutation . type === 'childList' ) {
181
+ updateNavigationToolbar ( toolbarContainerMutation . target as HTMLDivElement ) ;
182
+ }
179
183
} ) ;
180
184
181
185
const config = { childList : true , subtree : true } ;
182
186
183
187
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 ) ;
192
189
observer . observe ( toolbarContainer , config ) ;
193
190
}
194
191
@@ -243,7 +240,7 @@ const ObjectPageTitle = forwardRef<HTMLDivElement, ObjectPageTitlePropTypes>((pr
243
240
{ actionsBar }
244
241
{ ! showNavigationInTopArea && actionsBar && navigationBar && (
245
242
< div
246
- className = { classNames . actionsSpacer }
243
+ className = { classNames . actionsSeparator }
247
244
data-component-name = "ObjectPageTitleActionsSeparator"
248
245
aria-hidden
249
246
/>
0 commit comments