Files
P4RS3LT0NGV3/js/utils/focus.js
Dustin Farley dc10a90851 refactor: migrate to modular tool-based architecture
- Implement tool registry system with individual tool modules
- Reorganize transformers into categorized source modules
- Remove emojiLibrary.js, consolidate into EmojiUtils and emojiData
- Fix mobile close button and tooltip functionality
- Add build system for transforms and emoji data
- Migrate from Python backend to pure JavaScript
- Add comprehensive documentation and testing
- Improve code organization and maintainability
- Ignore generated files (transforms-bundle.js, emojiData.js)
2025-12-02 20:26:32 -08:00

30 lines
819 B
JavaScript

window.FocusUtils = {
focusWithoutScroll(element) {
if (!element) return;
try {
const scrollX = window.pageXOffset || window.scrollX || 0;
const scrollY = window.pageYOffset || window.scrollY || 0;
element.focus();
window.scrollTo(scrollX, scrollY);
} catch (e) {
try {
element.focus();
} catch (err) {
console.warn('Failed to focus element:', err);
}
}
},
clearFocusAndSelection() {
if (document.activeElement && document.activeElement.blur) {
document.activeElement.blur();
}
if (window.getSelection) {
window.getSelection().removeAllRanges();
}
document.body.focus();
}
};