File tree Expand file tree Collapse file tree 4 files changed +25
-1
lines changed Expand file tree Collapse file tree 4 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " bits-ui " : patch
3+ ---
4+
5+ improve(ContextMenu): allow users to override ` pointer-events ` style on ` ContextMenu.Trigger `
Original file line number Diff line number Diff line change 2424 });
2525
2626 const mergedProps = $derived (
27- mergeProps (restProps , triggerState .props , { style: { pointerEvents: " auto" } })
27+ mergeProps (
28+ restProps ,
29+ triggerState .props ,
30+ { style: { pointerEvents: " auto" } },
31+ {
32+ style: restProps .style ,
33+ }
34+ )
2835 );
2936 </script >
3037
Original file line number Diff line number Diff line change 1111 portalProps? : Omit <ContextMenu .PortalProps , " children" | " child" >;
1212 subTriggerProps? : Omit <ContextMenu .SubTriggerProps , " children" | " child" >;
1313 checkboxGroupProps? : Omit <ContextMenu .CheckboxGroupProps , " children" | " child" | " value" >;
14+ triggerProps? : Omit <ContextMenu .TriggerProps , " children" | " child" >;
1415 openFocusOverride? : boolean ;
1516 };
1617 </script >
2829 subTriggerProps = {},
2930 checkboxGroupProps = {},
3031 openFocusOverride = false ,
32+ triggerProps = {},
3133 ... restProps
3234 }: ContextMenuTestProps = $props ();
3335 </script >
4143 class =" h-[500px] w-[500px]"
4244 aria-expanded ={undefined }
4345 aria-controls ={undefined }
46+ {...triggerProps }
4447 >
4548 open
4649 </ContextMenu .Trigger >
Original file line number Diff line number Diff line change @@ -469,3 +469,12 @@ it("should open nested context menus", async () => {
469469 await expectExists ( page . getByTestId ( "nested-content" ) ) ;
470470 await expectExists ( page . getByTestId ( "content" ) ) ;
471471} ) ;
472+
473+ it ( "should allow overriding the pointer events style" , async ( ) => {
474+ setup ( { triggerProps : { style : { pointerEvents : undefined } } } ) ;
475+ const trigger = page . getByTestId ( "trigger" ) ;
476+ await trigger . click ( { button : "right" } ) ;
477+ await expectExists ( page . getByTestId ( "content" ) ) ;
478+ await trigger . click ( { button : "right" , force : true } ) ;
479+ await expectNotExists ( page . getByTestId ( "content" ) ) ;
480+ } ) ;
You can’t perform that action at this time.
0 commit comments