Skip to content

Commit 8a511df

Browse files
authored
do we need to manipulate z-index?? (#1166)
* do we need to manipulate z-index?? * fix lint * wrong import style * remove styleString which is unused * Remove zIndex data/template argument all together * remove cssVar and style attribute ALL TOGETHER. Assumes the modal z-index=15 (not 20) * Reduce chat-btn z-index to be below overlay which is below the modal
1 parent cdad0c4 commit 8a511df

File tree

5 files changed

+5
-25
lines changed

5 files changed

+5
-25
lines changed

packages/boxel-ui/addon/src/components/modal/index.gts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Component from '@glimmer/component';
33
import setBodyClass from 'ember-set-body-class/helpers/set-body-class';
44

55
import cssVar from '../../helpers/css-var.ts';
6-
import { bool, eq } from '../../helpers/truth-helpers.ts';
6+
import { eq } from '../../helpers/truth-helpers.ts';
77

88
interface Signature {
99
Args: {
@@ -16,7 +16,6 @@ interface Signature {
1616
layer?: 'urgent';
1717
onClose: () => void;
1818
size?: 'x-small' | 'small' | 'medium' | 'large' | 'full-screen';
19-
zIndex?: number;
2019
};
2120
Blocks: {
2221
default: [];
@@ -37,13 +36,9 @@ export default class Modal extends Component<Signature> {
3736
<div
3837
style={{cssVar
3938
boxel-modal-z-index=(if
40-
(bool @zIndex)
41-
@zIndex
42-
(if
43-
(eq @layer 'urgent')
44-
'var(--boxel-layer-modal-urgent)'
45-
'var(--boxel-layer-modal-default)'
46-
)
39+
(eq @layer 'urgent')
40+
'var(--boxel-layer-modal-urgent)'
41+
'var(--boxel-layer-modal-default)'
4742
)
4843
}}
4944
>

packages/host/app/components/card-catalog/modal.gts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { action } from '@ember/object';
55
import type Owner from '@ember/owner';
66
import { service } from '@ember/service';
77
import Component from '@glimmer/component';
8-
import { tracked } from '@glimmer/tracking';
98

109
import { restartableTask, task } from 'ember-concurrency';
1110
import focusTrap from 'ember-focus-trap/modifiers/focus-trap';
@@ -94,7 +93,6 @@ export default class CardCatalogModal extends Component<Signature> {
9493
class='card-catalog-modal'
9594
@title={{this.state.chooseCardTitle}}
9695
@onClose={{fn this.pick undefined}}
97-
@zIndex={{this.zIndex}}
9896
{{focusTrap
9997
isActive=(not this.state.dismissModal)
10098
focusTrapOptions=(hash
@@ -228,7 +226,6 @@ export default class CardCatalogModal extends Component<Signature> {
228226

229227
stateStack: State[] = new TrackedArray<State>();
230228
stateId = 0;
231-
@tracked zIndex = 20;
232229
@service declare cardService: CardService;
233230
@service declare loaderService: LoaderService;
234231
@service declare operatorModeStateService: OperatorModeStateService;
@@ -305,7 +302,6 @@ export default class CardCatalogModal extends Component<Signature> {
305302
createNewCard?: CreateNewCard;
306303
},
307304
): Promise<undefined | T> {
308-
this.zIndex++;
309305
return (await this._chooseCard.perform(
310306
{
311307
// default to title sort so that we can maintain stability in

packages/host/app/components/create-card-modal.gts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export default class CreateCardModal extends Component {
3434
<ModalContainer
3535
@title='Create New Card'
3636
@onClose={{fn this.save undefined}}
37-
@zIndex={{this.zIndex}}
3837
data-test-create-new-card={{card.constructor.name}}
3938
>
4039
<:content>
@@ -52,7 +51,6 @@ export default class CreateCardModal extends Component {
5251
deferred: Deferred<CardDef | undefined>;
5352
}
5453
| undefined = undefined;
55-
@tracked zIndex = 20;
5654

5755
constructor(owner: Owner, args: {}) {
5856
super(owner, args);
@@ -70,7 +68,6 @@ export default class CreateCardModal extends Component {
7068
doc?: LooseSingleCardDocument;
7169
},
7270
): Promise<undefined | T> {
73-
this.zIndex++;
7471
return (await this._create.perform(ref, relativeTo, opts)) as T | undefined;
7572
}
7673

packages/host/app/components/modal-container.gts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { on } from '@ember/modifier';
2-
import { htmlSafe } from '@ember/template';
32
import Component from '@glimmer/component';
43

54
import {
@@ -16,7 +15,6 @@ interface Signature {
1615
Args: {
1716
title: string;
1817
onClose: () => void;
19-
zIndex?: number;
2018
size?: 'small' | 'medium' | 'large';
2119
centered?: boolean;
2220
cardContainerClass?: string;
@@ -44,8 +42,6 @@ export default class ModalContainer extends Component<Signature> {
4442
@isOpen={{this.isOpen}}
4543
@onClose={{@onClose}}
4644
@centered={{@centered}}
47-
@zIndex={{@zIndex}}
48-
style={{this.styleString}}
4945
...attributes
5046
>
5147
<CardContainer
@@ -162,8 +158,4 @@ export default class ModalContainer extends Component<Signature> {
162158
}
163159
</style>
164160
</template>
165-
166-
get styleString() {
167-
return htmlSafe(`z-index: ${this.args.zIndex ?? 20}`);
168-
}
169161
}

packages/host/app/components/operator-mode/submode-layout.gts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ export default class SubmodeLayout extends Component<Signature> {
256256
margin-right: 0;
257257
background-color: var(--boxel-ai-purple);
258258
box-shadow: var(--boxel-deep-box-shadow);
259-
z-index: calc(var(--boxel-modal-z-index) - 1);
259+
z-index: calc(var(--boxel-modal-z-index) - 2);
260260
}
261261
262262
.ai-assistant-panel {

0 commit comments

Comments
 (0)