mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 12:32:08 +02:00
MDL-62848 form: Fix width of the autocomplete input field
Make sure that the autcomplete input field is wide enough to display the placeholder text.
This commit is contained in:
parent
5cdf8d49c7
commit
c261ada88b
@ -41,3 +41,13 @@
|
||||
{{^showSuggestions}}
|
||||
<input type="text" id="{{inputId}}" placeholder="{{placeholder}}" role="textbox" aria-owns="{{selectionId}}"/>
|
||||
{{/showSuggestions}}
|
||||
|
||||
{{#js}}
|
||||
require(['jquery'], function($) {
|
||||
// Set the minimum width of the input so that the placeholder is whole displayed.
|
||||
var inputElement = $(document.getElementById('{{inputId}}'));
|
||||
if (inputElement.length) {
|
||||
inputElement.css('min-width', inputElement.attr('placeholder').length + 'ch');
|
||||
}
|
||||
});
|
||||
{{/js}}
|
||||
|
@ -41,3 +41,13 @@
|
||||
{{^showSuggestions}}
|
||||
<input type="text" id="{{inputId}}" placeholder="{{placeholder}}" role="textbox" aria-owns="{{selectionId}}"/>
|
||||
{{/showSuggestions}}
|
||||
|
||||
{{#js}}
|
||||
require(['jquery'], function($) {
|
||||
// Set the minimum width of the input so that the placeholder is whole displayed.
|
||||
var inputElement = $(document.getElementById('{{inputId}}'));
|
||||
if (inputElement.length) {
|
||||
inputElement.css('min-width', inputElement.attr('placeholder').length + 'ch');
|
||||
}
|
||||
});
|
||||
{{/js}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user