Skip to content

Commit

Permalink
Sticky: Always render narrator readable content in place (#11483)
Browse files Browse the repository at this point in the history
#### Pull request checklist

- [ ] Addresses an existing issue: Fixes #9597
- [ ] Include a change request file using `$ yarn change`

#### Description of changes

Scrollable pane was moving sticky content out of flow. This change ensures that there is already readable text in the sticky area. 

#### Focus areas to test

This solution assumes that the nonStickyContent is not rendered in place. Will this break users who aren't using scrollable pane?
  • Loading branch information
micahgodbolt authored and msft-github-bot committed Dec 18, 2019
1 parent 4d85ac5 commit 1741c28
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "minor",
"comment": "Sticky: Always render narrator readable content in place",
"packageName": "office-ui-fabric-react",
"email": "[email protected]",
"commit": "b719af739bcf3ec0cb98ae10d1ee5e250db0a8a1",
"date": "2019-12-16T20:37:45.775Z"
}
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,13 @@ export class ScrollablePaneBase extends BaseComponent<IScrollablePaneProps, IScr
<div ref={this._contentContainer} className={classNames.contentContainer} data-is-scrollable={true}>
<ScrollablePaneContext.Provider value={this._getScrollablePaneContext()}>{this.props.children}</ScrollablePaneContext.Provider>
</div>
<div ref={this._stickyAboveRef} className={classNames.stickyAbove} style={this._getStickyContainerStyle(stickyTopHeight, true)} />
<div className={classNames.stickyBelow} style={this._getStickyContainerStyle(stickyBottomHeight, false)}>
<div
aria-hidden="true"
ref={this._stickyAboveRef}
className={classNames.stickyAbove}
style={this._getStickyContainerStyle(stickyTopHeight, true)}
/>
<div aria-hidden="true" className={classNames.stickyBelow} style={this._getStickyContainerStyle(stickyBottomHeight, false)}>
<div ref={this._stickyBelowRef} className={classNames.stickyBelowItems} />
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ exports[`ScrollablePane renders correctly 1`] = `
data-is-scrollable={true}
/>
<div
aria-hidden="true"
className=
{
Expand All @@ -53,6 +54,7 @@ exports[`ScrollablePane renders correctly 1`] = `
}
/>
<div
aria-hidden="true"
className=
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as PropTypes from 'prop-types';
import * as React from 'react';
import { BaseComponent } from '../../Utilities';
import { hiddenContentStyle } from '../../Styling';
import { IScrollablePaneContext, ScrollablePaneContext } from '../ScrollablePane/ScrollablePane.types';
import { IStickyProps, StickyPositionType } from './Sticky.types';

Expand Down Expand Up @@ -161,7 +162,9 @@ export class Sticky extends BaseComponent<IStickyProps, IStickyState> {
</div>
)}
<div style={this._getNonStickyPlaceholderHeightAndWidth()} ref={this._placeHolder}>
{(isStickyTop || isStickyBottom) && <span style={hiddenContentStyle as any}>{children}</span>}
<div
aria-hidden={isStickyTop || isStickyBottom}
ref={this._nonStickyContent}
className={isStickyTop || isStickyBottom ? stickyClassName : undefined}
style={this._getContentStyles(isStickyTop || isStickyBottom)}
Expand Down

0 comments on commit 1741c28

Please sign in to comment.