Fix #3942: Show password icon not placed correctly if field was initially hidden

This commit is contained in:
buddh4 2020-03-23 17:55:13 +01:00
parent b1db317965
commit 125d09588b
2 changed files with 15 additions and 2 deletions

View File

@ -9,6 +9,7 @@ HumHub Change Log
- Fix #3914: Directory link in space chooser still visible when directory module not active
- Fix #3915: Removed default border from canvas style
- Fix #3885: Prevent comments on archived content
- Fix #3942: Show password icon not placed correctly if field was initially hidden
1.4.3 (March 4, 2020)
---------------------

View File

@ -14,9 +14,21 @@ humhub.module('ui.form.elements', function (module, require, $) {
});
additions.register('password', '[type="password"]', function ($match) {
$match.each(function () {
var $input = $(this);
var $formGroup = $input.parent('.form-group');
var invisibleTop = 0;
/**
* We can't calculate top if input is invisible,
* Note, this may not work for more complex cases.
*/
if(!$input.is(':visible')) {
if($input.siblings('label').length) {
invisibleTop = '23px';
}
}
if($formGroup.length) {
$formGroup.css('position', 'relative');
@ -35,7 +47,7 @@ humhub.module('ui.form.elements', function (module, require, $) {
'padding': '4px',
'font-size': '19px',
'cursor': 'pointer',
'top': $input.position().top
'top': !$input.is(':visible') ? invisibleTop : $input.position().top
});
$formGroup.prepend($pwShow);
@ -127,7 +139,7 @@ humhub.module('ui.form.elements', function (module, require, $) {
};
var timeZoneSelected = function(evt) {
$toggleButton = evt.$trigger.parent().siblings('.timeZoneToggle:first');
var $toggleButton = evt.$trigger.parent().siblings('.timeZoneToggle:first');
$toggleButton.text(evt.$trigger.find('option:selected').text());
evt.$trigger.parent().hide();
};