Skip to content

Commit

Permalink
Merge pull request PrestaShop#13219 from PierreRambaud/fix/13040
Browse files Browse the repository at this point in the history
ScrollIntoView if field is invalid
  • Loading branch information
matks authored May 7, 2019
2 parents 79b5844 + b59913d commit e75a6b6
Show file tree
Hide file tree
Showing 42 changed files with 155 additions and 92 deletions.
37 changes: 37 additions & 0 deletions admin-dev/themes/new-theme/js/app/utils/fields.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* 2007-2019 PrestaShop and Contributors
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/OSL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to https://www.prestashop.com for more information.
*
* @author PrestaShop SA <[email protected]>
* @copyright 2007-2019 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/

const $ = global.$;

/**
* Enable all datepickers.
*/
const initInvalidFields = () => {
$('input,select,textarea').on('invalid', function scroll() {
this.scrollIntoView(false);
});
};

export default initInvalidFields;
2 changes: 2 additions & 0 deletions admin-dev/themes/new-theme/js/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ new NavBar();
new Header();

import initDatePickers from './app/utils/datepicker';
import initInvalidFields from './app/utils/fields';

$(() => {
initDatePickers();
initInvalidFields();
});
2 changes: 1 addition & 1 deletion admin-dev/themes/new-theme/public/backup.bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion admin-dev/themes/new-theme/public/catalog.bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e75a6b6

Please sign in to comment.