@targetprocess/popover 12.19.5-alpha.3 → 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() {
@@ -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-3 {\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-3 {\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-3 {\r\n padding: 0;\r\n }\r\n\r\n.popover-tip__popover__12-19-5-alpha-3 {\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-3: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-3,\r\n .popover-tip--top__popover__12-19-5-alpha-3 {\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-3,\r\n .popover-tip--right__popover__12-19-5-alpha-3 {\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-3: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-3: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-3: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-3: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-3","popover-body":"popover-body__popover__12-19-5-alpha-3","popover-body--no-padding":"popover-body--no-padding__popover__12-19-5-alpha-3","popover-tip":"popover-tip__popover__12-19-5-alpha-3","popover-tip--bottom":"popover-tip--bottom__popover__12-19-5-alpha-3","popover-tip--top":"popover-tip--top__popover__12-19-5-alpha-3","popover-tip--left":"popover-tip--left__popover__12-19-5-alpha-3","popover-tip--right":"popover-tip--right__popover__12-19-5-alpha-3"};
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;
@@ -492,13 +495,6 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
492
495
  value: function componentDidMount() {
493
496
  this.mounted = true;
494
497
  this.adjustPosition();
495
- if (this.popoverContentRef.current && this.props.role === 'dialog') {
496
- if (!focusFirstDescendant(this.popoverContentRef.current)) {
497
- this.popoverContentRef.current.tabIndex = 0;
498
- this.popoverContentRef.current.focus();
499
- }
500
- trapFocus(this.popoverContentRef.current);
501
- }
502
498
  if (this.props.role === 'tooltip') {
503
499
  this.popoverContentRef.current.tabIndex = 0;
504
500
  this.popoverContentRef.current.focus();
@@ -510,6 +506,12 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
510
506
  this.props.containerElement.addEventListener('scroll', this.onScroll);
511
507
  }
512
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
+ }
513
515
  }
514
516
  }, {
515
517
  key: "componentDidUpdate",
@@ -517,6 +519,9 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
517
519
  if (this.props.containerElement !== previousProps.containerElement || this.props.getPopoverPosition !== previousProps.getPopoverPosition) {
518
520
  this.adjustPosition();
519
521
  }
522
+ if (this.popoverContentRef.current && this.props.role === 'dialog') {
523
+ trapFocus(this.popoverContentRef.current);
524
+ }
520
525
  }
521
526
  }, {
522
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-3 {\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-3 {\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-3 {\r\n padding: 0;\r\n }\r\n\r\n.popover-tip__popover__12-19-5-alpha-3 {\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-3: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-3,\r\n .popover-tip--top__popover__12-19-5-alpha-3 {\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-3,\r\n .popover-tip--right__popover__12-19-5-alpha-3 {\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-3: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-3: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-3: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-3: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-3","popover-body":"popover-body__popover__12-19-5-alpha-3","popover-body--no-padding":"popover-body--no-padding__popover__12-19-5-alpha-3","popover-tip":"popover-tip__popover__12-19-5-alpha-3","popover-tip--bottom":"popover-tip--bottom__popover__12-19-5-alpha-3","popover-tip--top":"popover-tip--top__popover__12-19-5-alpha-3","popover-tip--left":"popover-tip--left__popover__12-19-5-alpha-3","popover-tip--right":"popover-tip--right__popover__12-19-5-alpha-3"};
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;
@@ -499,13 +502,6 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
499
502
  value: function componentDidMount() {
500
503
  this.mounted = true;
501
504
  this.adjustPosition();
502
- if (this.popoverContentRef.current && this.props.role === 'dialog') {
503
- if (!focusFirstDescendant(this.popoverContentRef.current)) {
504
- this.popoverContentRef.current.tabIndex = 0;
505
- this.popoverContentRef.current.focus();
506
- }
507
- trapFocus(this.popoverContentRef.current);
508
- }
509
505
  if (this.props.role === 'tooltip') {
510
506
  this.popoverContentRef.current.tabIndex = 0;
511
507
  this.popoverContentRef.current.focus();
@@ -517,6 +513,12 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
517
513
  this.props.containerElement.addEventListener('scroll', this.onScroll);
518
514
  }
519
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
+ }
520
522
  }
521
523
  }, {
522
524
  key: "componentDidUpdate",
@@ -524,6 +526,9 @@ var PopoverContainer = /*#__PURE__*/function (_React$Component) {
524
526
  if (this.props.containerElement !== previousProps.containerElement || this.props.getPopoverPosition !== previousProps.getPopoverPosition) {
525
527
  this.adjustPosition();
526
528
  }
529
+ if (this.popoverContentRef.current && this.props.role === 'dialog') {
530
+ trapFocus(this.popoverContentRef.current);
531
+ }
527
532
  }
528
533
  }, {
529
534
  key: "componentWillUnmount",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@targetprocess/popover",
3
- "version": "12.19.5-alpha.3",
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": "6acc350de401d2739358a5a64f0a5e923e9a7c08"
24
+ "gitHead": "72a67af985f910913188a875ae2c94f190213bd2"
25
25
  }