Skip to content

Commit 81e1d3d

Browse files
fix(editor-container): minor UI issues (#371)
* fix(editor-container): missing tabindex on root editor-container * test: adapt snapshots * refactor(substation-editor): remove unused section close tag * fix(editor-container): remove overflow set padding to prevent margin collapse
1 parent c94826d commit 81e1d3d

File tree

5 files changed

+64
-59
lines changed

5 files changed

+64
-59
lines changed

__snapshots__/bay-editor.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
#### `looks like the latest snapshot`
44

55
```html
6-
<editor-container nomargin="">
6+
<editor-container
7+
nomargin=""
8+
tabindex="0"
9+
>
710
<abbr
811
slot="header"
912
title="[lnode.tooltip]"
@@ -60,7 +63,10 @@
6063
#### `looks like the latest snapshot`
6164

6265
```html
63-
<editor-container nomargin="">
66+
<editor-container
67+
nomargin=""
68+
tabindex="0"
69+
>
6470
<abbr
6571
slot="header"
6672
title="[lnode.tooltip]"

__snapshots__/substation-editor.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#### `looks like the latest snapshot`
44

55
```html
6-
<editor-container>
6+
<editor-container tabindex="0">
77
<abbr
88
slot="header"
99
title="[lnode.tooltip]"
@@ -52,7 +52,7 @@
5252
#### `looks like the latest snapshot`
5353

5454
```html
55-
<editor-container>
55+
<editor-container tabindex="0">
5656
<abbr
5757
slot="header"
5858
title="[lnode.tooltip]"

__snapshots__/voltage-level-editor.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
#### `looks like the latest snapshot`
44

55
```html
6-
<editor-container header="E1 - Voltage Level
7-
(110.0 kV)">
6+
<editor-container
7+
header="E1 - Voltage Level
8+
(110.0 kV)"
9+
tabindex="0"
10+
>
811
<abbr
912
slot="header"
1013
title="[lnode.tooltip]"
@@ -55,8 +58,11 @@
5558
#### `looks like the latest snapshot`
5659

5760
```html
58-
<editor-container header="E1 - Voltage Level
59-
(110.0 kV)">
61+
<editor-container
62+
header="E1 - Voltage Level
63+
(110.0 kV)"
64+
tabindex="0"
65+
>
6066
<abbr
6167
slot="header"
6268
title="[lnode.tooltip]"

src/editor-container.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ export class EditorContainer extends LitElement {
7777
async firstUpdated(): Promise<void> {
7878
await super.updateComplete;
7979

80+
this.tabIndex = 0;
81+
8082
if (this.addMenu) this.addMenu.anchor = this.headerContainer;
8183

8284
const parentEditorContainer =
@@ -91,8 +93,6 @@ export class EditorContainer extends LitElement {
9193
);
9294

9395
this.contrasted = !parentEditorContainer.contrasted;
94-
95-
this.tabIndex = 0;
9696
}
9797

9898
private renderAddButtons(): TemplateResult[] {
@@ -199,7 +199,7 @@ export class EditorContainer extends LitElement {
199199
transition: all 200ms linear;
200200
outline-style: solid;
201201
margin: 8px 12px 16px;
202-
overflow: hidden;
202+
padding: 0.05px;
203203
outline-width: 0px;
204204
outline-color: var(--mdc-theme-primary);
205205
opacity: 1;
@@ -219,7 +219,6 @@ export class EditorContainer extends LitElement {
219219
220220
.nomargin {
221221
margin: 0px;
222-
overflow: visible;
223222
}
224223
225224
:host {

src/zeroline/substation-editor.ts

Lines changed: 41 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -70,53 +70,47 @@ export class SubstationEditor extends LitElement {
7070
}
7171

7272
render(): TemplateResult {
73-
return html`
74-
<editor-container
75-
.element=${this.element}
76-
>
77-
${this.renderIedContainer()}
78-
<abbr slot="header" title="${translate('lnode.tooltip')}">
79-
<mwc-icon-button
80-
icon="account_tree"
81-
@click=${() => this.openLNodeWizard()}
82-
></mwc-icon-button>
83-
</abbr>
84-
<abbr slot="header" title="${translate('duplicate')}">
85-
<mwc-icon-button
86-
icon="content_copy"
87-
@click=${() => cloneSubstationElement(this)}
88-
></mwc-icon-button>
89-
</abbr>
90-
<abbr slot="header" title="${translate('edit')}">
91-
<mwc-icon-button
92-
icon="edit"
93-
@click=${() => this.openEditWizard()}
94-
></mwc-icon-button>
95-
</abbr>
96-
<abbr slot="header" title="${translate('move')}">
97-
<mwc-icon-button
98-
icon="forward"
99-
@click=${() =>
100-
startMove(this, SubstationEditor, SubstationEditor)}
101-
></mwc-icon-button>
102-
</abbr>
103-
<abbr slot="header" title="${translate('remove')}">
104-
<mwc-icon-button
105-
icon="delete"
106-
@click=${() => this.remove()}
107-
></mwc-icon-button> </abbr
108-
>${Array.from(
109-
this.element.querySelectorAll(selectors.VoltageLevel)
110-
).map(
111-
voltageLevel =>
112-
html`<voltage-level-editor
113-
.element=${voltageLevel}
114-
.getAttachedIeds=${this.getAttachedIeds}
115-
?readonly=${this.readonly}
116-
></voltage-level-editor>`
117-
)}</editor-container>
118-
</section>
119-
`;
73+
return html`<editor-container .element=${this.element}>
74+
<abbr slot="header" title="${translate('lnode.tooltip')}">
75+
<mwc-icon-button
76+
icon="account_tree"
77+
@click=${() => this.openLNodeWizard()}
78+
></mwc-icon-button>
79+
</abbr>
80+
<abbr slot="header" title="${translate('duplicate')}">
81+
<mwc-icon-button
82+
icon="content_copy"
83+
@click=${() => cloneSubstationElement(this)}
84+
></mwc-icon-button>
85+
</abbr>
86+
<abbr slot="header" title="${translate('edit')}">
87+
<mwc-icon-button
88+
icon="edit"
89+
@click=${() => this.openEditWizard()}
90+
></mwc-icon-button>
91+
</abbr>
92+
<abbr slot="header" title="${translate('move')}">
93+
<mwc-icon-button
94+
icon="forward"
95+
@click=${() => startMove(this, SubstationEditor, SubstationEditor)}
96+
></mwc-icon-button>
97+
</abbr>
98+
<abbr slot="header" title="${translate('remove')}">
99+
<mwc-icon-button
100+
icon="delete"
101+
@click=${() => this.remove()}
102+
></mwc-icon-button
103+
></abbr>
104+
${this.renderIedContainer()}
105+
${Array.from(this.element.querySelectorAll(selectors.VoltageLevel)).map(
106+
voltageLevel =>
107+
html`<voltage-level-editor
108+
.element=${voltageLevel}
109+
.getAttachedIeds=${this.getAttachedIeds}
110+
?readonly=${this.readonly}
111+
></voltage-level-editor>`
112+
)}</editor-container
113+
>`;
120114
}
121115

122116
static styles = css`

0 commit comments

Comments
 (0)