@targetprocess/popover 12.19.5-alpha.1 → 12.19.5-alpha.4

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.
@@ -154,13 +154,6 @@ export class PopoverContainer extends React.Component<
154
154
  this.mounted = true
155
155
  this.adjustPosition()
156
156
 
157
- if (this.popoverContentRef.current && this.props.role === 'dialog') {
158
- if (!focusFirstDescendant(this.popoverContentRef.current)) {
159
- this.popoverContentRef.current.tabIndex = 0
160
- this.popoverContentRef.current.focus()
161
- }
162
- trapFocus(this.popoverContentRef.current)
163
- }
164
157
  if (this.props.role === 'tooltip') {
165
158
  this.popoverContentRef.current.tabIndex = 0
166
159
  this.popoverContentRef.current.focus()
@@ -173,6 +166,13 @@ export class PopoverContainer extends React.Component<
173
166
  this.props.containerElement.addEventListener('scroll', this.onScroll)
174
167
  }
175
168
  }
169
+
170
+ if (this.popoverContentRef.current && this.props.role === 'dialog') {
171
+ if (!focusFirstDescendant(this.popoverContentRef.current)) {
172
+ this.popoverContentRef.current.tabIndex = 0
173
+ this.popoverContentRef.current.focus()
174
+ }
175
+ }
176
176
  }
177
177
 
178
178
  componentDidUpdate(previousProps) {
@@ -182,6 +182,10 @@ export class PopoverContainer extends React.Component<
182
182
  ) {
183
183
  this.adjustPosition()
184
184
  }
185
+
186
+ if (this.popoverContentRef.current && this.props.role === 'dialog') {
187
+ trapFocus(this.popoverContentRef.current)
188
+ }
185
189
  }
186
190
 
187
191
  componentWillUnmount() {
@@ -214,6 +218,7 @@ export class PopoverContainer extends React.Component<
214
218
 
215
219
  handleKeyDown = event => {
216
220
  if (event.key === 'Escape') {
221
+ event.stopPropagation()
217
222
  this.props.onEscapeAction(event)
218
223
  }
219
224
  }
@@ -254,8 +254,8 @@ function styleInject(css, ref) {
254
254
  }
255
255
  }
256
256
 
257
- var css = ".popover-body-container__popover__12-19-5-alpha-1 {\r\n -webkit-box-shadow: var(--BoxShadowL, 0 4px 16px 0 rgba(0, 0, 0, 0.12));\r\n box-shadow: var(--BoxShadowL, 0 4px 16px 0 rgba(0, 0, 0, 0.12));\r\n border-radius: var(--BorderRadiusL, 4px);\r\n border: 1px solid var(--HighlightBlockBorderColor, rgba(64, 66, 73, 0.1));\r\n background: var(--BackgroundDefault, #FFFFFF);\r\n z-index: var(--ZIndexModal, 10001);\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n}\r\n\r\n.popover-body__popover__12-19-5-alpha-1 {\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n padding: var(--SpaceSM, 12px);\r\n font-size: var(--FontSizeDefault, 13px);\r\n color: var(--FontColorDefault, #000000);\r\n}\r\n\r\n.popover-body--no-padding__popover__12-19-5-alpha-1 {\r\n padding: 0;\r\n }\r\n\r\n.popover-tip__popover__12-19-5-alpha-1 {\r\n position: absolute;\r\n pointer-events: none;\r\n z-index: calc(var(--ZIndexModal, 10001) + 1);\r\n overflow: hidden;\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-align: center;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n -webkit-box-pack: center;\r\n -ms-flex-pack: center;\r\n justify-content: center;\r\n}\r\n\r\n.popover-tip__popover__12-19-5-alpha-1:before {\r\n content: '';\r\n position: absolute;\r\n display: block;\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n background-color: var(--BackgroundDefault, #FFFFFF);\r\n border: 1px solid var(--HighlightBlockBorderColor, rgba(64, 66, 73, 0.1));\r\n /*\r\n geometry FTW\r\n\r\n 2*$popoverTipSize\r\n _______ _______\r\n | /|\\ |\r\n | / | \\ | $popoverTipSize\r\n | / | \\ |\r\n |/______|______\\|\r\n since tip is rotated 45 degrees, its width and height is a\r\n diagonal of a square with side=$popoverTipSize, thus diagonal\r\n is sqrt(2) * $popoverTipSize.\r\n sqrt(2) ~= 1.414, 1.4 used here to prevent too much rounding\r\n */\r\n width: 11.2px;\r\n height: 11.2px;\r\n -webkit-transform: rotate(45deg);\r\n transform: rotate(45deg);\r\n }\r\n\r\n.popover-tip--bottom__popover__12-19-5-alpha-1,\r\n .popover-tip--top__popover__12-19-5-alpha-1 {\r\n width: 100%;\r\n border-top: 1px var(--BackgroundDefault, #FFFFFF);\r\n border-bottom: 1px var(--BackgroundDefault, #FFFFFF);\r\n height: 9px;\r\n }\r\n\r\n.popover-tip--left__popover__12-19-5-alpha-1,\r\n .popover-tip--right__popover__12-19-5-alpha-1 {\r\n border-left: 1px var(--BackgroundDefault, #FFFFFF);\r\n border-right: 1px var(--BackgroundDefault, #FFFFFF);\r\n height: 100%;\r\n width: 9px;\r\n }\r\n\r\n/*\r\n To determine tip position, we need to rotate it\r\n along the \"tip\" point, after that, the \"tip\" point\r\n can be placed with exactly 50% offset from the origin\r\n so that it is centered.\r\n */\r\n\r\n.popover-tip--bottom__popover__12-19-5-alpha-1:before {\r\n -webkit-transform-origin: left top;\r\n transform-origin: left top;\r\n left: 50%;\r\n top: 0;\r\n }\r\n\r\n.popover-tip--top__popover__12-19-5-alpha-1:before {\r\n -webkit-transform-origin: right bottom;\r\n transform-origin: right bottom;\r\n right: 50%;\r\n bottom: 0;\r\n }\r\n\r\n.popover-tip--left__popover__12-19-5-alpha-1:before {\r\n -webkit-transform-origin: right top;\r\n transform-origin: right top;\r\n right: 0;\r\n top: 50%;\r\n }\r\n\r\n.popover-tip--right__popover__12-19-5-alpha-1:before {\r\n -webkit-transform-origin: left bottom;\r\n transform-origin: left bottom;\r\n left: 0;\r\n bottom: 50%;\r\n }\r\n";
258
- var styles = {"popover-body-container":"popover-body-container__popover__12-19-5-alpha-1","popover-body":"popover-body__popover__12-19-5-alpha-1","popover-body--no-padding":"popover-body--no-padding__popover__12-19-5-alpha-1","popover-tip":"popover-tip__popover__12-19-5-alpha-1","popover-tip--bottom":"popover-tip--bottom__popover__12-19-5-alpha-1","popover-tip--top":"popover-tip--top__popover__12-19-5-alpha-1","popover-tip--left":"popover-tip--left__popover__12-19-5-alpha-1","popover-tip--right":"popover-tip--right__popover__12-19-5-alpha-1"};
257
+ var css = ".popover-body-container__popover__12-19-5-alpha-4 {\r\n -webkit-box-shadow: var(--BoxShadowL, 0 4px 16px 0 rgba(0, 0, 0, 0.12));\r\n box-shadow: var(--BoxShadowL, 0 4px 16px 0 rgba(0, 0, 0, 0.12));\r\n border-radius: var(--BorderRadiusL, 4px);\r\n border: 1px solid var(--HighlightBlockBorderColor, rgba(64, 66, 73, 0.1));\r\n background: var(--BackgroundDefault, #FFFFFF);\r\n z-index: var(--ZIndexModal, 10001);\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n}\r\n\r\n.popover-body__popover__12-19-5-alpha-4 {\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n padding: var(--SpaceSM, 12px);\r\n font-size: var(--FontSizeDefault, 13px);\r\n color: var(--FontColorDefault, #000000);\r\n}\r\n\r\n.popover-body--no-padding__popover__12-19-5-alpha-4 {\r\n padding: 0;\r\n }\r\n\r\n.popover-tip__popover__12-19-5-alpha-4 {\r\n position: absolute;\r\n pointer-events: none;\r\n z-index: calc(var(--ZIndexModal, 10001) + 1);\r\n overflow: hidden;\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-align: center;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n -webkit-box-pack: center;\r\n -ms-flex-pack: center;\r\n justify-content: center;\r\n}\r\n\r\n.popover-tip__popover__12-19-5-alpha-4:before {\r\n content: '';\r\n position: absolute;\r\n display: block;\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n background-color: var(--BackgroundDefault, #FFFFFF);\r\n border: 1px solid var(--HighlightBlockBorderColor, rgba(64, 66, 73, 0.1));\r\n /*\r\n geometry FTW\r\n\r\n 2*$popoverTipSize\r\n _______ _______\r\n | /|\\ |\r\n | / | \\ | $popoverTipSize\r\n | / | \\ |\r\n |/______|______\\|\r\n since tip is rotated 45 degrees, its width and height is a\r\n diagonal of a square with side=$popoverTipSize, thus diagonal\r\n is sqrt(2) * $popoverTipSize.\r\n sqrt(2) ~= 1.414, 1.4 used here to prevent too much rounding\r\n */\r\n width: 11.2px;\r\n height: 11.2px;\r\n -webkit-transform: rotate(45deg);\r\n transform: rotate(45deg);\r\n }\r\n\r\n.popover-tip--bottom__popover__12-19-5-alpha-4,\r\n .popover-tip--top__popover__12-19-5-alpha-4 {\r\n width: 100%;\r\n border-top: 1px var(--BackgroundDefault, #FFFFFF);\r\n border-bottom: 1px var(--BackgroundDefault, #FFFFFF);\r\n height: 9px;\r\n }\r\n\r\n.popover-tip--left__popover__12-19-5-alpha-4,\r\n .popover-tip--right__popover__12-19-5-alpha-4 {\r\n border-left: 1px var(--BackgroundDefault, #FFFFFF);\r\n border-right: 1px var(--BackgroundDefault, #FFFFFF);\r\n height: 100%;\r\n width: 9px;\r\n }\r\n\r\n/*\r\n To determine tip position, we need to rotate it\r\n along the \"tip\" point, after that, the \"tip\" point\r\n can be placed with exactly 50% offset from the origin\r\n so that it is centered.\r\n */\r\n\r\n.popover-tip--bottom__popover__12-19-5-alpha-4:before {\r\n -webkit-transform-origin: left top;\r\n transform-origin: left top;\r\n left: 50%;\r\n top: 0;\r\n }\r\n\r\n.popover-tip--top__popover__12-19-5-alpha-4:before {\r\n -webkit-transform-origin: right bottom;\r\n transform-origin: right bottom;\r\n right: 50%;\r\n bottom: 0;\r\n }\r\n\r\n.popover-tip--left__popover__12-19-5-alpha-4:before {\r\n -webkit-transform-origin: right top;\r\n transform-origin: right top;\r\n right: 0;\r\n top: 50%;\r\n }\r\n\r\n.popover-tip--right__popover__12-19-5-alpha-4:before {\r\n -webkit-transform-origin: left bottom;\r\n transform-origin: left bottom;\r\n left: 0;\r\n bottom: 50%;\r\n }\r\n";
258
+ var styles = {"popover-body-container":"popover-body-container__popover__12-19-5-alpha-4","popover-body":"popover-body__popover__12-19-5-alpha-4","popover-body--no-padding":"popover-body--no-padding__popover__12-19-5-alpha-4","popover-tip":"popover-tip__popover__12-19-5-alpha-4","popover-tip--bottom":"popover-tip--bottom__popover__12-19-5-alpha-4","popover-tip--top":"popover-tip--top__popover__12-19-5-alpha-4","popover-tip--left":"popover-tip--left__popover__12-19-5-alpha-4","popover-tip--right":"popover-tip--right__popover__12-19-5-alpha-4"};
259
259
  styleInject(css);
260
260
 
261
261
  var PopoverBody = function PopoverBody(_ref) {
@@ -299,6 +299,9 @@ var isFocusable = function isFocusable(element) {
299
299
  if ('disabled' in element && element.disabled) {
300
300
  return false;
301
301
  }
302
+ if (element.tabIndex === 0) {
303
+ return true;
304
+ }
302
305
  switch (element.nodeName) {
303
306
  case 'A':
304
307
  return element.href;
@@ -446,6 +449,7 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
446
449
  };
447
450
  _this.handleKeyDown = function (event) {
448
451
  if (event.key === 'Escape') {
452
+ event.stopPropagation();
449
453
  _this.props.onEscapeAction(event);
450
454
  }
451
455
  };
@@ -491,13 +495,6 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
491
495
  value: function componentDidMount() {
492
496
  this.mounted = true;
493
497
  this.adjustPosition();
494
- if (this.popoverContentRef.current && this.props.role === 'dialog') {
495
- if (!focusFirstDescendant(this.popoverContentRef.current)) {
496
- this.popoverContentRef.current.tabIndex = 0;
497
- this.popoverContentRef.current.focus();
498
- }
499
- trapFocus(this.popoverContentRef.current);
500
- }
501
498
  if (this.props.role === 'tooltip') {
502
499
  this.popoverContentRef.current.tabIndex = 0;
503
500
  this.popoverContentRef.current.focus();
@@ -509,6 +506,12 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
509
506
  this.props.containerElement.addEventListener('scroll', this.onScroll);
510
507
  }
511
508
  }
509
+ if (this.popoverContentRef.current && this.props.role === 'dialog') {
510
+ if (!focusFirstDescendant(this.popoverContentRef.current)) {
511
+ this.popoverContentRef.current.tabIndex = 0;
512
+ this.popoverContentRef.current.focus();
513
+ }
514
+ }
512
515
  }
513
516
  }, {
514
517
  key: "componentDidUpdate",
@@ -516,6 +519,9 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
516
519
  if (this.props.containerElement !== previousProps.containerElement || this.props.getPopoverPosition !== previousProps.getPopoverPosition) {
517
520
  this.adjustPosition();
518
521
  }
522
+ if (this.popoverContentRef.current && this.props.role === 'dialog') {
523
+ trapFocus(this.popoverContentRef.current);
524
+ }
519
525
  }
520
526
  }, {
521
527
  key: "componentWillUnmount",
package/dist/popover.js CHANGED
@@ -261,8 +261,8 @@ function styleInject(css, ref) {
261
261
  }
262
262
  }
263
263
 
264
- var css = ".popover-body-container__popover__12-19-5-alpha-1 {\r\n -webkit-box-shadow: var(--BoxShadowL, 0 4px 16px 0 rgba(0, 0, 0, 0.12));\r\n box-shadow: var(--BoxShadowL, 0 4px 16px 0 rgba(0, 0, 0, 0.12));\r\n border-radius: var(--BorderRadiusL, 4px);\r\n border: 1px solid var(--HighlightBlockBorderColor, rgba(64, 66, 73, 0.1));\r\n background: var(--BackgroundDefault, #FFFFFF);\r\n z-index: var(--ZIndexModal, 10001);\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n}\r\n\r\n.popover-body__popover__12-19-5-alpha-1 {\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n padding: var(--SpaceSM, 12px);\r\n font-size: var(--FontSizeDefault, 13px);\r\n color: var(--FontColorDefault, #000000);\r\n}\r\n\r\n.popover-body--no-padding__popover__12-19-5-alpha-1 {\r\n padding: 0;\r\n }\r\n\r\n.popover-tip__popover__12-19-5-alpha-1 {\r\n position: absolute;\r\n pointer-events: none;\r\n z-index: calc(var(--ZIndexModal, 10001) + 1);\r\n overflow: hidden;\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-align: center;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n -webkit-box-pack: center;\r\n -ms-flex-pack: center;\r\n justify-content: center;\r\n}\r\n\r\n.popover-tip__popover__12-19-5-alpha-1:before {\r\n content: '';\r\n position: absolute;\r\n display: block;\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n background-color: var(--BackgroundDefault, #FFFFFF);\r\n border: 1px solid var(--HighlightBlockBorderColor, rgba(64, 66, 73, 0.1));\r\n /*\r\n geometry FTW\r\n\r\n 2*$popoverTipSize\r\n _______ _______\r\n | /|\\ |\r\n | / | \\ | $popoverTipSize\r\n | / | \\ |\r\n |/______|______\\|\r\n since tip is rotated 45 degrees, its width and height is a\r\n diagonal of a square with side=$popoverTipSize, thus diagonal\r\n is sqrt(2) * $popoverTipSize.\r\n sqrt(2) ~= 1.414, 1.4 used here to prevent too much rounding\r\n */\r\n width: 11.2px;\r\n height: 11.2px;\r\n -webkit-transform: rotate(45deg);\r\n transform: rotate(45deg);\r\n }\r\n\r\n.popover-tip--bottom__popover__12-19-5-alpha-1,\r\n .popover-tip--top__popover__12-19-5-alpha-1 {\r\n width: 100%;\r\n border-top: 1px var(--BackgroundDefault, #FFFFFF);\r\n border-bottom: 1px var(--BackgroundDefault, #FFFFFF);\r\n height: 9px;\r\n }\r\n\r\n.popover-tip--left__popover__12-19-5-alpha-1,\r\n .popover-tip--right__popover__12-19-5-alpha-1 {\r\n border-left: 1px var(--BackgroundDefault, #FFFFFF);\r\n border-right: 1px var(--BackgroundDefault, #FFFFFF);\r\n height: 100%;\r\n width: 9px;\r\n }\r\n\r\n/*\r\n To determine tip position, we need to rotate it\r\n along the \"tip\" point, after that, the \"tip\" point\r\n can be placed with exactly 50% offset from the origin\r\n so that it is centered.\r\n */\r\n\r\n.popover-tip--bottom__popover__12-19-5-alpha-1:before {\r\n -webkit-transform-origin: left top;\r\n transform-origin: left top;\r\n left: 50%;\r\n top: 0;\r\n }\r\n\r\n.popover-tip--top__popover__12-19-5-alpha-1:before {\r\n -webkit-transform-origin: right bottom;\r\n transform-origin: right bottom;\r\n right: 50%;\r\n bottom: 0;\r\n }\r\n\r\n.popover-tip--left__popover__12-19-5-alpha-1:before {\r\n -webkit-transform-origin: right top;\r\n transform-origin: right top;\r\n right: 0;\r\n top: 50%;\r\n }\r\n\r\n.popover-tip--right__popover__12-19-5-alpha-1:before {\r\n -webkit-transform-origin: left bottom;\r\n transform-origin: left bottom;\r\n left: 0;\r\n bottom: 50%;\r\n }\r\n";
265
- var styles = {"popover-body-container":"popover-body-container__popover__12-19-5-alpha-1","popover-body":"popover-body__popover__12-19-5-alpha-1","popover-body--no-padding":"popover-body--no-padding__popover__12-19-5-alpha-1","popover-tip":"popover-tip__popover__12-19-5-alpha-1","popover-tip--bottom":"popover-tip--bottom__popover__12-19-5-alpha-1","popover-tip--top":"popover-tip--top__popover__12-19-5-alpha-1","popover-tip--left":"popover-tip--left__popover__12-19-5-alpha-1","popover-tip--right":"popover-tip--right__popover__12-19-5-alpha-1"};
264
+ var css = ".popover-body-container__popover__12-19-5-alpha-4 {\r\n -webkit-box-shadow: var(--BoxShadowL, 0 4px 16px 0 rgba(0, 0, 0, 0.12));\r\n box-shadow: var(--BoxShadowL, 0 4px 16px 0 rgba(0, 0, 0, 0.12));\r\n border-radius: var(--BorderRadiusL, 4px);\r\n border: 1px solid var(--HighlightBlockBorderColor, rgba(64, 66, 73, 0.1));\r\n background: var(--BackgroundDefault, #FFFFFF);\r\n z-index: var(--ZIndexModal, 10001);\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n}\r\n\r\n.popover-body__popover__12-19-5-alpha-4 {\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n padding: var(--SpaceSM, 12px);\r\n font-size: var(--FontSizeDefault, 13px);\r\n color: var(--FontColorDefault, #000000);\r\n}\r\n\r\n.popover-body--no-padding__popover__12-19-5-alpha-4 {\r\n padding: 0;\r\n }\r\n\r\n.popover-tip__popover__12-19-5-alpha-4 {\r\n position: absolute;\r\n pointer-events: none;\r\n z-index: calc(var(--ZIndexModal, 10001) + 1);\r\n overflow: hidden;\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-align: center;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n -webkit-box-pack: center;\r\n -ms-flex-pack: center;\r\n justify-content: center;\r\n}\r\n\r\n.popover-tip__popover__12-19-5-alpha-4:before {\r\n content: '';\r\n position: absolute;\r\n display: block;\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n background-color: var(--BackgroundDefault, #FFFFFF);\r\n border: 1px solid var(--HighlightBlockBorderColor, rgba(64, 66, 73, 0.1));\r\n /*\r\n geometry FTW\r\n\r\n 2*$popoverTipSize\r\n _______ _______\r\n | /|\\ |\r\n | / | \\ | $popoverTipSize\r\n | / | \\ |\r\n |/______|______\\|\r\n since tip is rotated 45 degrees, its width and height is a\r\n diagonal of a square with side=$popoverTipSize, thus diagonal\r\n is sqrt(2) * $popoverTipSize.\r\n sqrt(2) ~= 1.414, 1.4 used here to prevent too much rounding\r\n */\r\n width: 11.2px;\r\n height: 11.2px;\r\n -webkit-transform: rotate(45deg);\r\n transform: rotate(45deg);\r\n }\r\n\r\n.popover-tip--bottom__popover__12-19-5-alpha-4,\r\n .popover-tip--top__popover__12-19-5-alpha-4 {\r\n width: 100%;\r\n border-top: 1px var(--BackgroundDefault, #FFFFFF);\r\n border-bottom: 1px var(--BackgroundDefault, #FFFFFF);\r\n height: 9px;\r\n }\r\n\r\n.popover-tip--left__popover__12-19-5-alpha-4,\r\n .popover-tip--right__popover__12-19-5-alpha-4 {\r\n border-left: 1px var(--BackgroundDefault, #FFFFFF);\r\n border-right: 1px var(--BackgroundDefault, #FFFFFF);\r\n height: 100%;\r\n width: 9px;\r\n }\r\n\r\n/*\r\n To determine tip position, we need to rotate it\r\n along the \"tip\" point, after that, the \"tip\" point\r\n can be placed with exactly 50% offset from the origin\r\n so that it is centered.\r\n */\r\n\r\n.popover-tip--bottom__popover__12-19-5-alpha-4:before {\r\n -webkit-transform-origin: left top;\r\n transform-origin: left top;\r\n left: 50%;\r\n top: 0;\r\n }\r\n\r\n.popover-tip--top__popover__12-19-5-alpha-4:before {\r\n -webkit-transform-origin: right bottom;\r\n transform-origin: right bottom;\r\n right: 50%;\r\n bottom: 0;\r\n }\r\n\r\n.popover-tip--left__popover__12-19-5-alpha-4:before {\r\n -webkit-transform-origin: right top;\r\n transform-origin: right top;\r\n right: 0;\r\n top: 50%;\r\n }\r\n\r\n.popover-tip--right__popover__12-19-5-alpha-4:before {\r\n -webkit-transform-origin: left bottom;\r\n transform-origin: left bottom;\r\n left: 0;\r\n bottom: 50%;\r\n }\r\n";
265
+ var styles = {"popover-body-container":"popover-body-container__popover__12-19-5-alpha-4","popover-body":"popover-body__popover__12-19-5-alpha-4","popover-body--no-padding":"popover-body--no-padding__popover__12-19-5-alpha-4","popover-tip":"popover-tip__popover__12-19-5-alpha-4","popover-tip--bottom":"popover-tip--bottom__popover__12-19-5-alpha-4","popover-tip--top":"popover-tip--top__popover__12-19-5-alpha-4","popover-tip--left":"popover-tip--left__popover__12-19-5-alpha-4","popover-tip--right":"popover-tip--right__popover__12-19-5-alpha-4"};
266
266
  styleInject(css);
267
267
 
268
268
  var PopoverBody = function PopoverBody(_ref) {
@@ -306,6 +306,9 @@ var isFocusable = function isFocusable(element) {
306
306
  if ('disabled' in element && element.disabled) {
307
307
  return false;
308
308
  }
309
+ if (element.tabIndex === 0) {
310
+ return true;
311
+ }
309
312
  switch (element.nodeName) {
310
313
  case 'A':
311
314
  return element.href;
@@ -453,6 +456,7 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
453
456
  };
454
457
  _this.handleKeyDown = function (event) {
455
458
  if (event.key === 'Escape') {
459
+ event.stopPropagation();
456
460
  _this.props.onEscapeAction(event);
457
461
  }
458
462
  };
@@ -498,13 +502,6 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
498
502
  value: function componentDidMount() {
499
503
  this.mounted = true;
500
504
  this.adjustPosition();
501
- if (this.popoverContentRef.current && this.props.role === 'dialog') {
502
- if (!focusFirstDescendant(this.popoverContentRef.current)) {
503
- this.popoverContentRef.current.tabIndex = 0;
504
- this.popoverContentRef.current.focus();
505
- }
506
- trapFocus(this.popoverContentRef.current);
507
- }
508
505
  if (this.props.role === 'tooltip') {
509
506
  this.popoverContentRef.current.tabIndex = 0;
510
507
  this.popoverContentRef.current.focus();
@@ -516,6 +513,12 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
516
513
  this.props.containerElement.addEventListener('scroll', this.onScroll);
517
514
  }
518
515
  }
516
+ if (this.popoverContentRef.current && this.props.role === 'dialog') {
517
+ if (!focusFirstDescendant(this.popoverContentRef.current)) {
518
+ this.popoverContentRef.current.tabIndex = 0;
519
+ this.popoverContentRef.current.focus();
520
+ }
521
+ }
519
522
  }
520
523
  }, {
521
524
  key: "componentDidUpdate",
@@ -523,6 +526,9 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
523
526
  if (this.props.containerElement !== previousProps.containerElement || this.props.getPopoverPosition !== previousProps.getPopoverPosition) {
524
527
  this.adjustPosition();
525
528
  }
529
+ if (this.popoverContentRef.current && this.props.role === 'dialog') {
530
+ trapFocus(this.popoverContentRef.current);
531
+ }
526
532
  }
527
533
  }, {
528
534
  key: "componentWillUnmount",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@targetprocess/popover",
3
- "version": "12.19.5-alpha.1",
3
+ "version": "12.19.5-alpha.4",
4
4
  "description": "",
5
5
  "main": "dist/popover.js",
6
6
  "module": "dist/popover.es.js",
@@ -21,5 +21,5 @@
21
21
  "publishConfig": {
22
22
  "access": "public"
23
23
  },
24
- "gitHead": "f828bdeb752c7d340ce6175d3f4305d652d28836"
24
+ "gitHead": "72a67af985f910913188a875ae2c94f190213bd2"
25
25
  }