@internetarchive/collection-browser 4.1.1 → 4.1.2-alpha-webdev8332.0

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.
@@ -227,7 +227,7 @@ export class HoverPaneController implements HoverPaneControllerInterface {
227
227
 
228
228
  /** @inheritdoc */
229
229
  toggleHoverPane(options: ToggleHoverPaneOptions): void {
230
- if (this.hoverPaneState === 'shown') {
230
+ if (this.hoverPaneState !== 'hidden') {
231
231
  this.fadeOutHoverPane();
232
232
  this.forceTouchBackdrop = false;
233
233
  } else {
@@ -546,6 +546,7 @@ export class HoverPaneController implements HoverPaneControllerInterface {
546
546
  if (this.hoverPaneState !== 'hidden') {
547
547
  this.fadeOutHoverPane();
548
548
  }
549
+ e.preventDefault();
549
550
  e.stopPropagation();
550
551
  };
551
552
 
@@ -218,6 +218,15 @@ export class TileDispatcher
218
218
  return window.matchMedia('(hover: hover)').matches;
219
219
  }
220
220
 
221
+ /**
222
+ * Whether the info button should be shown on this tile.
223
+ * Only shown on touch/non-hover devices where a hover pane is available,
224
+ * so the button always has something to toggle.
225
+ */
226
+ private get shouldShowInfoButton(): boolean {
227
+ return !this.isHoverEnabled && this.shouldPrepareHoverPane;
228
+ }
229
+
221
230
  /** @inheritdoc */
222
231
  getHoverPane(): TileHoverPane | undefined {
223
232
  return this.hoverPane;
@@ -326,7 +335,7 @@ export class TileDispatcher
326
335
  .suppressBlurring=${this.suppressBlurring}
327
336
  .isManageView=${this.isManageView}
328
337
  .layoutType=${this.layoutType}
329
- ?showInfoButton=${!this.isHoverEnabled}
338
+ ?showInfoButton=${this.shouldShowInfoButton}
330
339
  @infoButtonPressed=${this.tileInfoButtonPressed}
331
340
  >
332
341
  </collection-tile>`;
@@ -340,7 +349,7 @@ export class TileDispatcher
340
349
  .creatorFilter=${creatorFilter}
341
350
  .suppressBlurring=${this.suppressBlurring}
342
351
  .isManageView=${this.isManageView}
343
- ?showInfoButton=${!this.isHoverEnabled}
352
+ ?showInfoButton=${this.shouldShowInfoButton}
344
353
  @infoButtonPressed=${this.tileInfoButtonPressed}
345
354
  >
346
355
  </account-tile>`;
@@ -373,7 +382,7 @@ export class TileDispatcher
373
382
  .isManageView=${this.isManageView}
374
383
  .layoutType=${this.layoutType}
375
384
  ?showTvClips=${this.showTvClips}
376
- ?showInfoButton=${!this.isHoverEnabled}
385
+ ?showInfoButton=${this.shouldShowInfoButton}
377
386
  ?useLocalTime=${this.useLocalTime}
378
387
  @infoButtonPressed=${this.tileInfoButtonPressed}
379
388
  >
@@ -213,6 +213,23 @@ describe('Tile Dispatcher', () => {
213
213
  await el.updateComplete;
214
214
  expect(el.getHoverPane()).not.to.exist;
215
215
  });
216
+
217
+ it('should not show info button when hover pane is not enabled', async () => {
218
+ const el = await fixture<TileDispatcher>(html`
219
+ <tile-dispatcher
220
+ .tileDisplayMode=${'grid'}
221
+ .model=${{ mediatype: 'texts' }}
222
+ .enableHoverPane=${false}
223
+ >
224
+ </tile-dispatcher>
225
+ `);
226
+
227
+ const itemTile = el.shadowRoot?.querySelector('item-tile') as ItemTile;
228
+ expect(itemTile).to.exist;
229
+
230
+ const infoButton = itemTile.shadowRoot?.querySelector('.info-button');
231
+ expect(infoButton).to.not.exist;
232
+ });
216
233
  });
217
234
 
218
235
  describe('Accessibility', () => {