PLT-5179 - Fixing modal overflow for autocomplete (#5002)

* PLT-5179 - Fixing modal overflow for autocomplete

* PLT-5171 - Fixing search bar popover behaviour
Этот коммит содержится в:
Asaad Mahmood
2017-01-09 19:32:27 +05:00
коммит произвёл Harrison Healey
родитель f6672605e8
Коммит 93a526f7ed
5 изменённых файлов: 41 добавлений и 55 удалений

Просмотреть файл

@@ -104,7 +104,6 @@ export default class SearchBar extends React.Component {
SearchStore.storeSearchTerm(term); SearchStore.storeSearchTerm(term);
SearchStore.emitSearchTermChange(false); SearchStore.emitSearchTermChange(false);
this.setState({searchTerm: term}); this.setState({searchTerm: term});
this.refs.searchOverlay.hide();
} }
handleUserBlur() { handleUserBlur() {
@@ -112,9 +111,8 @@ export default class SearchBar extends React.Component {
} }
handleUserFocus() { handleUserFocus() {
$('.search-bar__container').addClass('focused');
this.setState({focused: true}); this.setState({focused: true});
$('.search-bar__container').addClass('focused');
} }
performSearch(terms, isMentionSearch) { performSearch(terms, isMentionSearch) {
@@ -180,6 +178,11 @@ export default class SearchBar extends React.Component {
isSearching = <span className={'fa fa-refresh fa-refresh-animate icon--refresh icon--rotate'}/>; isSearching = <span className={'fa fa-refresh fa-refresh-animate icon--refresh icon--rotate'}/>;
} }
let helpClass = 'search-help-popover';
if (!this.state.searchTerm && this.state.focused) {
helpClass += ' visible';
}
const recentMentionsTooltip = ( const recentMentionsTooltip = (
<Tooltip id='recentMentionsTooltip'> <Tooltip id='recentMentionsTooltip'>
<FormattedMessage <FormattedMessage
@@ -189,19 +192,6 @@ export default class SearchBar extends React.Component {
</Tooltip> </Tooltip>
); );
const searchPopover = (
<Popover
id='searchbar-help-popup'
placement='bottom'
className='search-help-popover'
>
<FormattedHTMLMessage
id='search_bar.usage'
defaultMessage='<h4>Search Options</h4><ul><li><span>Use </span><b>"quotation marks"</b><span> to search for phrases</span></li><li><span>Use </span><b>from:</b><span> to find posts from specific users and </span><b>in:</b><span> to find posts in specific channels</span></li></ul>'
/>
</Popover>
);
const flaggedTooltip = ( const flaggedTooltip = (
<Tooltip id='flaggedTooltip'> <Tooltip id='flaggedTooltip'>
<FormattedMessage <FormattedMessage
@@ -285,14 +275,6 @@ export default class SearchBar extends React.Component {
autoComplete='off' autoComplete='off'
> >
<span className='fa fa-search sidebar__search-icon'/> <span className='fa fa-search sidebar__search-icon'/>
<OverlayTrigger
ref='searchOverlay'
delayShow={Constants.OVERLAY_TIME_DELAY_SMALL}
placement='bottom'
overlay={searchPopover}
trigger='click'
rootClose={true}
>
<SuggestionBox <SuggestionBox
ref='search' ref='search'
className='form-control search-bar' className='form-control search-bar'
@@ -305,8 +287,17 @@ export default class SearchBar extends React.Component {
providers={this.suggestionProviders} providers={this.suggestionProviders}
type='search' type='search'
/> />
</OverlayTrigger>
{isSearching} {isSearching}
<Popover
id='searchbar-help-popup'
placement='bottom'
className={helpClass}
>
<FormattedHTMLMessage
id='search_bar.usage'
defaultMessage='<h4>Search Options</h4><ul><li><span>Use </span><b>"quotation marks"</b><span> to search for phrases</span></li><li><span>Use </span><b>from:</b><span> to find posts from specific users and </span><b>in:</b><span> to find posts in specific channels</span></li></ul>'
/>
</Popover>
</form> </form>
{mentionBtn} {mentionBtn}

Просмотреть файл

@@ -64,6 +64,7 @@ export default class SuggestionBox extends React.Component {
// Delay this slightly so that we don't clear the suggestions before we run click handlers on SuggestionList // Delay this slightly so that we don't clear the suggestions before we run click handlers on SuggestionList
GlobalActions.emitClearSuggestions(this.suggestionId); GlobalActions.emitClearSuggestions(this.suggestionId);
}, 100); }, 100);
this.props.onBlur();
} }
handleChange(e) { handleChange(e) {
@@ -272,6 +273,7 @@ SuggestionBox.propTypes = {
renderDividers: React.PropTypes.bool, renderDividers: React.PropTypes.bool,
// explicitly name any input event handlers we override and need to manually call // explicitly name any input event handlers we override and need to manually call
onBlur: React.PropTypes.func,
onChange: React.PropTypes.func, onChange: React.PropTypes.func,
onKeyDown: React.PropTypes.func, onKeyDown: React.PropTypes.func,
onItemSelected: React.PropTypes.func onItemSelected: React.PropTypes.func

Просмотреть файл

@@ -12,7 +12,6 @@
.modal-body { .modal-body {
max-height: calc(90vh - 62px); max-height: calc(90vh - 62px);
overflow: auto;
padding: 20px 15px; padding: 20px 15px;
} }
@@ -24,10 +23,6 @@
min-height: 8em; min-height: 8em;
} }
.suggestion-list {
bottom: -149px;
}
.suggestion-list__content { .suggestion-list__content {
max-height: 150px; max-height: 150px;
} }

Просмотреть файл

@@ -93,21 +93,20 @@
} }
.search-help-popover { .search-help-popover {
@include single-transition(opacity, .3s, ease-in);
font-size: em(13px); font-size: em(13px);
max-width: 300px; max-width: 350px;
top: 36px;
visibility: hidden;
width: 100%; width: 100%;
&:not(.autocomplete) {
margin-top: 17px !important;
}
&.autocomplete { &.autocomplete {
display: block; display: block;
.popover-content { .popover-content {
-webkit-overflow-scrolling: touch;
padding: 10px; padding: 10px;
position: relative; position: relative;
-webkit-overflow-scrolling: touch;
} }
} }
@@ -206,6 +205,11 @@
.tooltip-inner { .tooltip-inner {
max-width: 100%; max-width: 100%;
} }
&.visible {
@include opacity(1);
visibility: visible;
}
} }
.member-list__popover { .member-list__popover {

Просмотреть файл

@@ -427,14 +427,8 @@
} }
.search-help-popover { .search-help-popover {
left: 0 !important; left: 55px;
margin-left: 10px;
max-width: calc(100% - 80px); max-width: calc(100% - 80px);
.focused & {
left: 45px !important;
margin-top: 50px;
}
} }
.modal-direct-channels, .modal-direct-channels,