Fix safari explore disappearing tabs (#20917)
* fix disappearing Explore tabs on Safari * fix lint Co-authored-by: nyura <nyura@hidden.com>pull/1950/head^2
parent
f890fdca41
commit
aaca78da78
|
@ -24,6 +24,16 @@ const mapStateToProps = state => ({
|
||||||
isSearching: state.getIn(['search', 'submitted']) || !showTrends,
|
isSearching: state.getIn(['search', 'submitted']) || !showTrends,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Fix strange bug on Safari where <span> (rendered by FormattedMessage) disappears
|
||||||
|
// after clicking around Explore top bar (issue #20885).
|
||||||
|
// Removing width=100% from <a> also fixes it, as well as replacing <span> with <div>
|
||||||
|
// We're choosing to wrap span with div to keep the changes local only to this tool bar.
|
||||||
|
const WrapFormattedMessage = ({ children, ...props }) => <div><FormattedMessage {...props}>{children}</FormattedMessage></div>;
|
||||||
|
WrapFormattedMessage.propTypes = {
|
||||||
|
children: PropTypes.any,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
export default @connect(mapStateToProps)
|
export default @connect(mapStateToProps)
|
||||||
@injectIntl
|
@injectIntl
|
||||||
class Explore extends React.PureComponent {
|
class Explore extends React.PureComponent {
|
||||||
|
@ -47,7 +57,7 @@ class Explore extends React.PureComponent {
|
||||||
this.column = c;
|
this.column = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render() {
|
||||||
const { intl, multiColumn, isSearching } = this.props;
|
const { intl, multiColumn, isSearching } = this.props;
|
||||||
const { signedIn } = this.context.identity;
|
const { signedIn } = this.context.identity;
|
||||||
|
|
||||||
|
@ -70,10 +80,10 @@ class Explore extends React.PureComponent {
|
||||||
) : (
|
) : (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<div className='account__section-headline'>
|
<div className='account__section-headline'>
|
||||||
<NavLink exact to='/explore'><FormattedMessage id='explore.trending_statuses' defaultMessage='Posts' /></NavLink>
|
<NavLink exact to='/explore'><WrapFormattedMessage id='explore.trending_statuses' defaultMessage='Posts' /></NavLink>
|
||||||
<NavLink exact to='/explore/tags'><FormattedMessage id='explore.trending_tags' defaultMessage='Hashtags' /></NavLink>
|
<NavLink exact to='/explore/tags'><WrapFormattedMessage id='explore.trending_tags' defaultMessage='Hashtags' /></NavLink>
|
||||||
<NavLink exact to='/explore/links'><FormattedMessage id='explore.trending_links' defaultMessage='News' /></NavLink>
|
<NavLink exact to='/explore/links'><WrapFormattedMessage id='explore.trending_links' defaultMessage='News' /></NavLink>
|
||||||
{signedIn && <NavLink exact to='/explore/suggestions'><FormattedMessage id='explore.suggested_follows' defaultMessage='For you' /></NavLink>}
|
{signedIn && <NavLink exact to='/explore/suggestions'><WrapFormattedMessage id='explore.suggested_follows' defaultMessage='For you' /></NavLink>}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Switch>
|
<Switch>
|
||||||
|
|
Loading…
Reference in New Issue