-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[Web] Fix scrolling in Node list in web terminal #26622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -35,8 +35,14 @@ export const SessionJoinBtn = ({ | |||||||
| participantModes: ParticipantMode[]; | ||||||||
| showCTA: boolean; | ||||||||
| }) => { | ||||||||
| const [anchorEl, setAnchorEl] = useState<HTMLElement>(null); | ||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A feedback for the future as this pattern wasn't introduced by this PR specifically, but I don't think it's a good practice to store HTML elements in the state – you might end up storing an element in the state that's no longer in DOM. Was this done as a workaround for some other problem? Looking at the previous version of
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
teleport/web/packages/design/src/Button/Button.jsx Lines 23 to 25 in 2bb3860
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed, I'll keep track of this and we can come back and refactor all our popover menu components at some point. |
||||||||
|
|
||||||||
| function closeMenu() { | ||||||||
| setAnchorEl(null); | ||||||||
| } | ||||||||
|
|
||||||||
| return ( | ||||||||
| <JoinMenu> | ||||||||
| <JoinMenu anchorEl={anchorEl} setAnchorEl={setAnchorEl}> | ||||||||
| {showCTA && ( | ||||||||
| <Box mx="12px" my="3"> | ||||||||
| <ButtonLockedFeature | ||||||||
|
|
@@ -56,6 +62,7 @@ export const SessionJoinBtn = ({ | |||||||
| participantMode="observer" | ||||||||
| key="observer" | ||||||||
| showCTA={showCTA} | ||||||||
| closeMenu={closeMenu} | ||||||||
| /> | ||||||||
| <JoinMenuItem | ||||||||
| title="As a Moderator" | ||||||||
|
|
@@ -65,6 +72,7 @@ export const SessionJoinBtn = ({ | |||||||
| participantMode="moderator" | ||||||||
| key="moderator" | ||||||||
| showCTA={showCTA} | ||||||||
| closeMenu={closeMenu} | ||||||||
| /> | ||||||||
| <JoinMenuItem | ||||||||
| title="As a Peer" | ||||||||
|
|
@@ -74,14 +82,21 @@ export const SessionJoinBtn = ({ | |||||||
| participantMode="peer" | ||||||||
| key="peer" | ||||||||
| showCTA={showCTA} | ||||||||
| closeMenu={closeMenu} | ||||||||
| /> | ||||||||
| </JoinMenu> | ||||||||
| ); | ||||||||
| }; | ||||||||
|
|
||||||||
| function JoinMenu({ children }: { children: React.ReactNode }) { | ||||||||
| const [anchorEl, setAnchorEl] = useState<HTMLElement>(null); | ||||||||
|
|
||||||||
| function JoinMenu({ | ||||||||
| children, | ||||||||
| anchorEl, | ||||||||
| setAnchorEl, | ||||||||
| }: { | ||||||||
| children: React.ReactNode; | ||||||||
| anchorEl: HTMLElement; | ||||||||
| setAnchorEl: React.Dispatch<React.SetStateAction<HTMLElement>>; | ||||||||
| }) { | ||||||||
| const handleClickListItem = (event: React.MouseEvent<HTMLElement>) => { | ||||||||
| setAnchorEl(event.currentTarget); | ||||||||
| }; | ||||||||
|
|
@@ -122,20 +137,23 @@ function JoinMenuItem({ | |||||||
| participantMode, | ||||||||
| url, | ||||||||
| showCTA, | ||||||||
| closeMenu, | ||||||||
| }: { | ||||||||
| title: string; | ||||||||
| description: string; | ||||||||
| hasAccess: boolean; | ||||||||
| participantMode: ParticipantMode; | ||||||||
| url: string; | ||||||||
| showCTA: boolean; | ||||||||
| closeMenu: () => void; | ||||||||
| }) { | ||||||||
| if (hasAccess && !showCTA) { | ||||||||
| return ( | ||||||||
| <MenuItem | ||||||||
| as="a" | ||||||||
| href={url} | ||||||||
| target="_blank" | ||||||||
| onClick={closeMenu} | ||||||||
| css={` | ||||||||
| text-decoration: none; | ||||||||
| padding: 8px 12px; | ||||||||
|
|
||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you remember why
overflow: hiddenwas added to StyledTableWrapper? If it's possible to get rid of it then I think long-term it might be a better fix than addingheight: fit-contenthere.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reasoning was for all our different tables (paginated, searchable, simple, etc.) to have rounded corners. Wrapping all tables with it and having it round the corners with a
borderRadiusmade it so we didn't have to always manually add a border radius for every table individually.