Skip to content

Commit 4b4a106

Browse files
authored
fix: layout shift when open Access drawer (#3108)
1 parent a35b54a commit 4b4a106

File tree

3 files changed

+35
-33
lines changed

3 files changed

+35
-33
lines changed

src/containers/Tenant/GrantAccess/GrantAccess.tsx

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ export function GrantAccess({handleCloseDrawer}: GrantAccessProps) {
134134
[setExplicitRightsChanges],
135135
);
136136

137+
const rightsLoading = aclIsFetching || availableRightsAreFetching;
138+
137139
const renderSubject = () => {
138140
if (aclSubject) {
139141
return <SubjectWithAvatar subject={aclSubject} />;
@@ -144,45 +146,45 @@ export function GrantAccess({handleCloseDrawer}: GrantAccessProps) {
144146
const subjectSelected = Boolean(aclSubject || newSubjects.length > 0);
145147

146148
return (
147-
<LoaderWrapper loading={aclIsFetching || availableRightsAreFetching}>
148-
<div className={block()}>
149-
<Flex direction="column">
150-
<Flex gap={4} direction="column" className={block('navigation')}>
151-
{renderSubject()}
152-
{/* wrapper to prevent radio button stretch */}
153-
{subjectSelected && (
154-
<RightsSectionSelector
155-
value={rightView}
156-
onUpdate={setRightsView}
157-
rights={currentRightsMap}
158-
availablePermissions={availablePermissions}
159-
/>
160-
)}
161-
</Flex>
149+
<Flex direction="column" className={block()} height={'100%'}>
150+
<Flex direction="column" grow={1}>
151+
<Flex gap={4} direction="column" className={block('navigation')}>
152+
{renderSubject()}
153+
{/* wrapper to prevent radio button stretch */}
162154
{subjectSelected && (
163-
<div className={block('rights-wrapper')}>
155+
<RightsSectionSelector
156+
value={rightView}
157+
onUpdate={setRightsView}
158+
rights={currentRightsMap}
159+
availablePermissions={availablePermissions}
160+
/>
161+
)}
162+
</Flex>
163+
{subjectSelected && (
164+
<LoaderWrapper loading={rightsLoading}>
165+
<Flex grow={1} position="relative" qa="access-rights-wrapper">
164166
<Rights
165167
inheritedRights={inheritedRightsSet}
166168
rights={currentRightsMap}
167169
availablePermissions={availablePermissions}
168170
handleChangeRightGetter={handleChangeRightGetter}
169171
view={rightView}
170172
/>
171-
</div>
172-
)}
173-
</Flex>
174-
175-
{subjectSelected && (
176-
<Footer
177-
onCancel={handleCloseDrawer}
178-
onDiscard={handleDiscardRightsChanges}
179-
onSave={handleSaveRightsChanges}
180-
loading={updateRightsResponse.isLoading}
181-
error={updateRightsError}
182-
disabled={!hasChanges}
183-
/>
173+
</Flex>
174+
</LoaderWrapper>
184175
)}
185-
</div>
186-
</LoaderWrapper>
176+
</Flex>
177+
178+
{subjectSelected && (
179+
<Footer
180+
onCancel={handleCloseDrawer}
181+
onDiscard={handleDiscardRightsChanges}
182+
onSave={handleSaveRightsChanges}
183+
loading={updateRightsResponse.isLoading}
184+
error={updateRightsError}
185+
disabled={!hasChanges}
186+
/>
187+
)}
188+
</Flex>
187189
);
188190
}

src/containers/Tenant/TenantDrawerRights.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export function TenantDrawerRights({children}: TenantDrawerWrapperProps) {
3636
isDrawerVisible={Boolean(showGrantAccess)}
3737
onCloseDrawer={handleCloseDrawer}
3838
renderDrawerContent={renderDrawerContent}
39-
drawerId="tenant-healthcheck-details"
39+
drawerId="tenant-grant-access"
4040
storageKey="tenant-grant-access-drawer-width"
4141
detectClickOutside
4242
hideVeil={false}

tests/suites/tenant/diagnostics/Diagnostics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ export class Diagnostics {
542542
}
543543

544544
async isRightsWrapperVisible(): Promise<boolean> {
545-
const rightsWrapper = this.page.locator('.ydb-grant-access__rights-wrapper');
545+
const rightsWrapper = this.page.getByTestId('access-rights-wrapper');
546546
return rightsWrapper.isVisible();
547547
}
548548

0 commit comments

Comments
 (0)