diff --git a/common/changes/@itwin/appui-layout-react/widget-tab-tippy_2022-05-25-13-12.json b/common/changes/@itwin/appui-layout-react/widget-tab-tippy_2022-05-25-13-12.json new file mode 100644 index 000000000000..c74da1d881a7 --- /dev/null +++ b/common/changes/@itwin/appui-layout-react/widget-tab-tippy_2022-05-25-13-12.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@itwin/appui-layout-react", + "comment": "Allow tippy.js to close when tab is clicked.", + "type": "none" + } + ], + "packageName": "@itwin/appui-layout-react" +} \ No newline at end of file diff --git a/ui/appui-layout-react/src/appui-layout-react/base/DragHandle.tsx b/ui/appui-layout-react/src/appui-layout-react/base/DragHandle.tsx index 27b1835176ef..86ef3d5c3ead 100644 --- a/ui/appui-layout-react/src/appui-layout-react/base/DragHandle.tsx +++ b/ui/appui-layout-react/src/appui-layout-react/base/DragHandle.tsx @@ -66,7 +66,6 @@ export class DragHandle extends React.PureComponent { style={this.props.style} role="presentation" > -
+
{ + e.preventDefault(); + }} + /> {this.props.children}
); diff --git a/ui/appui-layout-react/src/appui-layout-react/widget/rectangular/ResizeGrip.tsx b/ui/appui-layout-react/src/appui-layout-react/widget/rectangular/ResizeGrip.tsx index b6df7351df59..69671ea275f3 100644 --- a/ui/appui-layout-react/src/appui-layout-react/widget/rectangular/ResizeGrip.tsx +++ b/ui/appui-layout-react/src/appui-layout-react/widget/rectangular/ResizeGrip.tsx @@ -137,7 +137,6 @@ export class ResizeGrip extends React.PureComponent renders correctly 1`] = ` >
`; @@ -20,6 +21,7 @@ exports[` should respect isPointerDown prop over state 1`] = ` >
`; diff --git a/ui/appui-layout-react/src/test/base/PointerCaptor.test.tsx b/ui/appui-layout-react/src/test/base/PointerCaptor.test.tsx index 144a0a87c897..f3fe6e7d3dc0 100644 --- a/ui/appui-layout-react/src/test/base/PointerCaptor.test.tsx +++ b/ui/appui-layout-react/src/test/base/PointerCaptor.test.tsx @@ -63,6 +63,18 @@ describe("", () => { spy.calledOnce.should.true; }); + + it("should prevent default on drag start", () => { + const sut = mount(); + const overlay = sut.find("div.nz-overlay"); + + const preventDefault = sinon.stub(); + overlay.simulate("dragStart", { + preventDefault, + }); + + preventDefault.calledOnceWithExactly().should.true; + }); }); describe("usePointerCaptor", () => { diff --git a/ui/appui-layout-react/src/test/widget/rectangular/tab/Tab.test.tsx b/ui/appui-layout-react/src/test/widget/rectangular/tab/Tab.test.tsx index 2094f1a12bd0..f9b761ef231e 100644 --- a/ui/appui-layout-react/src/test/widget/rectangular/tab/Tab.test.tsx +++ b/ui/appui-layout-react/src/test/widget/rectangular/tab/Tab.test.tsx @@ -95,22 +95,6 @@ describe("", () => { result.bottom.should.eq(0); }); - it("should prevent default on pointer down", () => { - const sut = mount(); - const pointerCaptor = sut.find(PointerCaptor); - - const pointerDown = new PointerEvent("pointerdown"); - const spy = sinon.spy(pointerDown, "preventDefault"); - - pointerCaptor.prop("onPointerDown")!(pointerDown); - - spy.calledOnceWithExactly().should.true; - }); - it("should invoke onClick handler", () => { const spy = sinon.spy(); const sut = mount(