Fix various code discrepancies

main
Claire 2023-11-15 22:45:43 +01:00
parent 09a5a78527
commit 4101057b9a
2 changed files with 15 additions and 15 deletions

View File

@ -106,24 +106,24 @@ export default class IntersectionObserverArticle extends Component {
const { children, id, index, listLength, cachedHeight } = this.props; const { children, id, index, listLength, cachedHeight } = this.props;
const { isIntersecting, isHidden } = this.state; const { isIntersecting, isHidden } = this.state;
const style = {};
if (!isIntersecting && (isHidden || cachedHeight)) { if (!isIntersecting && (isHidden || cachedHeight)) {
style.height = `${this.height || cachedHeight || 150}px`; return (
style.opacity = 0; <article
style.overflow = 'hidden'; ref={this.handleRef}
aria-posinset={index + 1}
aria-setsize={listLength}
style={{ height: `${this.height || cachedHeight}px`, opacity: 0, overflow: 'hidden' }}
data-id={id}
tabIndex={-1}
>
{children && cloneElement(children, { hidden: true })}
</article>
);
} }
return ( return (
<article <article ref={this.handleRef} aria-posinset={index + 1} aria-setsize={listLength} data-id={id} tabIndex={-1}>
ref={this.handleRef} {children && cloneElement(children, { hidden: false })}
aria-posinset={index + 1}
aria-setsize={listLength}
data-id={id}
tabIndex={0}
style={style}
>
{children && cloneElement(children, { hidden: !isIntersecting && (isHidden || !!cachedHeight) })}
</article> </article>
); );
} }

View File

@ -33,7 +33,7 @@ class Blocks extends ImmutablePureComponent {
params: PropTypes.object.isRequired, params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired, dispatch: PropTypes.func.isRequired,
hasMore: PropTypes.bool, hasMore: PropTypes.bool,
domains: ImmutablePropTypes.list, domains: ImmutablePropTypes.orderedSet,
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
multiColumn: PropTypes.bool, multiColumn: PropTypes.bool,
}; };