@fluid-topics/ft-popover 1.2.8 → 1.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,6 +6,7 @@ import { Position } from "@fluid-topics/ft-tooltip";
6
6
  export declare class FtdsPopover extends FtLitElement implements FtdsPopoverProperties {
7
7
  static elementDefinitions: ElementDefinitionsMap;
8
8
  static styles: import("lit").CSSResult;
9
+ private popoverOpenTriggeredWithKeyboard;
9
10
  heading: string;
10
11
  closeButtonLabel: string;
11
12
  openButtonLabel: string;
@@ -25,7 +26,7 @@ export declare class FtdsPopover extends FtLitElement implements FtdsPopoverProp
25
26
  renderHeading(): typeof nothing | import("lit").TemplateResult<1>;
26
27
  updated(properties: PropertyValues<FtdsPopover>): void;
27
28
  close(): void;
28
- open(): void;
29
+ open(event: PointerEvent): void;
29
30
  hasTextLinkContent(): boolean;
30
31
  private watchFocusIn;
31
32
  private watchEscapeKey;
@@ -16,6 +16,7 @@ import { FtIcons } from "@fluid-topics/ft-icon";
16
16
  class FtdsPopover extends FtLitElement {
17
17
  constructor() {
18
18
  super(...arguments);
19
+ this.popoverOpenTriggeredWithKeyboard = false;
19
20
  this.heading = "";
20
21
  this.closeButtonLabel = "close info";
21
22
  this.openButtonLabel = "more info";
@@ -31,12 +32,13 @@ class FtdsPopover extends FtLitElement {
31
32
  };
32
33
  this.watchEscapeKey = (event) => {
33
34
  if (event.key === "Escape") {
34
- this.closeAndFocusOpeningButton();
35
+ this.close();
36
+ this.openingButton.focus();
35
37
  }
36
38
  };
37
- this.closeAndFocusOpeningButton = () => {
39
+ this.closeAndFocusOpeningButton = (event) => {
38
40
  this.close();
39
- this.openingButton.focus();
41
+ !!event.pointerType ? this.openingButton.focusWithoutTooltip() : this.openingButton.focus();
40
42
  };
41
43
  }
42
44
  render() {
@@ -118,7 +120,8 @@ class FtdsPopover extends FtLitElement {
118
120
  this.opened = false;
119
121
  this.dispatchEvent(new CustomEvent("opened-changed", { detail: { opened: false } }));
120
122
  }
121
- open() {
123
+ open(event) {
124
+ this.popoverOpenTriggeredWithKeyboard = !event.pointerType;
122
125
  this.opened = true;
123
126
  this.dispatchEvent(new CustomEvent("opened-changed", { detail: { opened: true } }));
124
127
  }
@@ -136,7 +139,7 @@ class FtdsPopover extends FtLitElement {
136
139
  this.popoverWrapper.style.top = `${y}px`;
137
140
  this.popoverWrapper.classList.add("ftds-popover--wrapper-positioned");
138
141
  this.popoverLinkTypography.hidden = !this.hasTextLinkContent();
139
- this.closingButton.focus();
142
+ this.popoverOpenTriggeredWithKeyboard ? this.closingButton.focus() : this.closingButton.focusWithoutTooltip();
140
143
  }
141
144
  }
142
145
  FtdsPopover.elementDefinitions = {
@@ -13,7 +13,7 @@ export const styles = css `
13
13
 
14
14
  .ftds-popover--container {
15
15
  position: absolute;
16
- z-index: 2;
16
+ z-index: 100;
17
17
  display: block;
18
18
  margin: auto;
19
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-popover",
3
- "version": "1.2.8",
3
+ "version": "1.2.9",
4
4
  "description": "A simple popover component",
5
5
  "keywords": [
6
6
  "Lit"
@@ -20,12 +20,12 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@fluid-topics/design-system-variables": "0.1.5",
23
- "@fluid-topics/ft-button": "1.2.8",
24
- "@fluid-topics/ft-icon": "1.2.8",
25
- "@fluid-topics/ft-link": "1.2.8",
26
- "@fluid-topics/ft-typography": "1.2.8",
27
- "@fluid-topics/ft-wc-utils": "1.2.8",
23
+ "@fluid-topics/ft-button": "1.2.9",
24
+ "@fluid-topics/ft-icon": "1.2.9",
25
+ "@fluid-topics/ft-link": "1.2.9",
26
+ "@fluid-topics/ft-typography": "1.2.9",
27
+ "@fluid-topics/ft-wc-utils": "1.2.9",
28
28
  "lit": "3.1.0"
29
29
  },
30
- "gitHead": "26d2cbd5aba536de63759b72e1c171449519d74e"
30
+ "gitHead": "d845852f5b176916a556b5a23d38be9472fa1fc6"
31
31
  }