Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

MediaWiki:Vector.js: Difference between revisions

MediaWiki interface page
m Fix: Check altKey instead of ctrlKey
Focus input instead of simulating a keypress
Line 3: Line 3:
var searchInput = document.getElementById('home-search');
var searchInput = document.getElementById('home-search');
searchInput.onclick = function() {
searchInput.onclick = function() {
document.dispatchEvent(new KeyboardEvent('keydown', {
var realSearch = document.querySelector('.cdx-text-input__input');
'key': 'F',
realSearch.focus();
'altKey': true,
'shiftKey': true
}));
};
};

Revision as of 13:57, 5 June 2025

/* All JavaScript here will be loaded for users of the Vector skin */
// Make the search bar on Template:Home/nav activate search.
var searchInput = document.getElementById('home-search');
searchInput.onclick = function() {
	var realSearch = document.querySelector('.cdx-text-input__input');
	realSearch.focus();
};
Cookies help us deliver our services. By using our services, you agree to our use of cookies.