-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show useful error when service workers unavailable (#224)
Detect when service workers are not available and show a useful error. Uses the same styling that we previously used on the main editor to prevent keyboard focus trap. The main place this comes up is when using Firefox in private browsing mode, which is not currently supported (see https://bugzilla.mozilla.org/show_bug.cgi?id=1320796). Fixes #78
- Loading branch information
Showing
4 changed files
with
120 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* @license | ||
* Copyright 2021 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
|
||
import {LitElement, css, html} from 'lit'; | ||
import {customElement} from 'lit/decorators.js'; | ||
|
||
/** | ||
* An absolutely positioned scrim with a floating message. | ||
*/ | ||
@customElement('playground-internal-overlay') | ||
export class PlaygroundInternalOverlay extends LitElement { | ||
static override styles = css` | ||
:host { | ||
position: absolute; | ||
width: 100%; | ||
height: 100%; | ||
box-sizing: border-box; | ||
left: 0; | ||
top: 0; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
background: transparent; | ||
z-index: 9; | ||
background: rgba(0, 0, 0, 0.32); | ||
overflow-y: auto; | ||
} | ||
#message { | ||
background: #fff; | ||
color: #000; | ||
padding: 10px 20px; | ||
border-radius: 5px; | ||
box-shadow: rgba(0, 0, 0, 0.3) 0 2px 10px; | ||
} | ||
`; | ||
|
||
override render() { | ||
return html`<div id="message"><slot></slot></div>`; | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
'playground-internal-overlay': PlaygroundInternalOverlay; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters