Skip to content

Commit 4c05a53

Browse files
pantharshit00huv1k
authored andcommitted
fix: focus state of sidetabs on button clicks (#913)
1 parent 562e1ef commit 4c05a53

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

packages/graphql-playground-react/src/components/Playground/ExplorerTabs/SideTabs.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,13 @@ class SideTabs extends React.Component<
9898
if (prevProps.activeTabIdx && !this.props.docs.activeTabIdx) {
9999
this.props.setDocsVisible(this.props.sessionId, false)
100100
}
101-
return this.setWidth()
101+
this.setWidth()
102+
if (
103+
this.props.docs.activeTabIdx !== prevProps.docs.activeTabIdx &&
104+
this.refContentContainer
105+
) {
106+
this.refContentContainer.focus()
107+
}
102108
}
103109

104110
componentDidMount() {
@@ -164,9 +170,6 @@ class SideTabs extends React.Component<
164170
}
165171

166172
private handleTabClick = idx => () => {
167-
if (!this.props.docs.docsOpen && this.refContentContainer) {
168-
this.refContentContainer.focus()
169-
}
170173
if (this.props.docs.activeTabIdx === idx) {
171174
this.props.setDocsVisible(this.props.sessionId, false)
172175
return this.setWidth()

packages/graphql-playground-react/src/components/Playground/SchemaExplorer/SDLEditor.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,11 @@ const Editor = styled.div`
152152
}
153153
`
154154
const OverflowShadow = styled.div`
155-
position: fixed:
156-
top: 0;
157-
left: 0;
158-
right: 0;
159-
height: 1px;
160-
box-shadow: 0px 1px 3px rgba(17, 17, 17, 0.1);
161-
z-index: 1000;
155+
position: fixed;
156+
top: 0;
157+
left: 0;
158+
right: 0;
159+
height: 1px;
160+
box-shadow: 0px 1px 3px rgba(17, 17, 17, 0.1);
161+
z-index: 1000;
162162
`

0 commit comments

Comments
 (0)