Skip to content

Commit

Permalink
[desk-tool] Use pane key as id prefix for aria attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars committed Nov 19, 2019
1 parent cf85d62 commit e0a1191
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions packages/@sanity/desk-tool/src/DeskToolPanes.js
Expand Up @@ -366,6 +366,7 @@ export default class DeskToolPanes extends React.Component {
) : (
<Pane
key={paneKey} // Use key to force rerendering pane on ID change
paneKey={paneKey}
index={i}
itemId={keys[i]}
onExpand={this.handlePaneExpand}
Expand Down
12 changes: 5 additions & 7 deletions packages/@sanity/desk-tool/src/pane/DocumentPane.js
Expand Up @@ -40,11 +40,6 @@ import EditorStatusBadge from './EditorStatusBadge'
import {getProductionPreviewItem, getMenuItems} from './documentPaneMenuItems'
import {validateDocument} from '@sanity/validation'

function noop() {
// eslint-disable-next-line no-console
console.warn('No handler defined for action')
}

// Want a nicer api for listen/unlisten
function listen(target, eventType, callback, useCapture = false) {
target.addEventListener(eventType, callback, useCapture)
Expand Down Expand Up @@ -184,9 +179,11 @@ export default withInitialValue(
static propTypes = {
styles: PropTypes.object, // eslint-disable-line react/forbid-prop-types
title: PropTypes.string,
paneKey: PropTypes.string.isRequired,
type: PropTypes.string.isRequired,
isSelected: PropTypes.bool.isRequired,
isCollapsed: PropTypes.bool.isRequired,
isClosable: PropTypes.bool.isRequired,
onExpand: PropTypes.func,
onCollapse: PropTypes.func,
menuItems: PropTypes.arrayOf(
Expand Down Expand Up @@ -1083,7 +1080,8 @@ export default withInitialValue(
onExpand,
menuItemGroups,
views,
options
options,
paneKey
} = this.props

const {
Expand Down Expand Up @@ -1195,7 +1193,7 @@ export default withInitialValue(
)}
<TabbedPane
key="pane"
idPrefix={`${getPublishedId(value._id)}-`}
idPrefix={paneKey}
title={this.getTitle(value)}
views={views}
activeView={activeViewId}
Expand Down

0 comments on commit e0a1191

Please sign in to comment.