Hello JLexArt Support Team,
While testing and customizing JLex Comment 3.8.2 on Joomla! 6.2, I encountered a minor bug and identified an opportunity to improve localization support. I would like to share both findings and the workarounds I have implemented.
1. Canceling comment editing scrolls the page to the top
When a user edits an existing comment and then clicks Cancel, the edit form closes correctly, but the browser unexpectedly scrolls to the top of the page.
This does not happen when the user clicks Post to save the edited comment.
The Cancel button is implemented as an anchor:
It appears that the click handler does not prevent the anchor's default behavior, causing the browser to navigate to `#` and scroll to the top.
My workaround: I added the following JavaScript to my template's `user.js`:
This resolves the problem without interfering with the original Cancel functionality.
Suggested fix: Call `event.preventDefault()` in the extension's existing Cancel click handler, so canceling an edit does not affect the page's scroll position.
2. Missing localization support in the emoji picker
Although the main JLex Comment interface can be translated using Joomla language files, some strings in the emoji picker remain in English.
In particular:
This makes it possible to translate them dynamically without changing the underlying emoji data.
My workaround: I added JavaScript that checks the page language (`document.documentElement.lang`), replaces category labels according to their IDs, and changes the search placeholder to "Vyhledat…" when the language is Czech.
Because the emoji picker updates its content dynamically, I use a `MutationObserver` to reapply translations when necessary.
Suggested improvement: Allow emoji picker interface strings to be localized through Joomla language constants, or provide a localization object when initializing the emoji picker.
For example, the picker could accept translations for category names, the search placeholder, loading messages, and empty search results.
This would make it much easier to provide a fully localized commenting interface without additional JavaScript modifications.
Conclusion
Both workarounds are functioning correctly in my installation. Neither requires changes to the core JLex Comment files.
I hope these findings will be useful for a future release. Thank you for your continued work on JLex Comment!
Best regards
While testing and customizing JLex Comment 3.8.2 on Joomla! 6.2, I encountered a minor bug and identified an opportunity to improve localization support. I would like to share both findings and the workarounds I have implemented.
1. Canceling comment editing scrolls the page to the top
When a user edits an existing comment and then clicks Cancel, the edit form closes correctly, but the browser unexpectedly scrolls to the top of the page.
This does not happen when the user clicks Post to save the edited comment.
The Cancel button is implemented as an anchor:
<a href="#" class="jcm-btn-cancel">Cancel</a>It appears that the click handler does not prevent the anchor's default behavior, causing the browser to navigate to `#` and scroll to the top.
My workaround: I added the following JavaScript to my template's `user.js`:
document.addEventListener('click', function (event) {
const cancel = event.target.closest(
'#jlexcomment a.jcm-btn-cancel[href="#"]'
);
if (cancel) {
event.preventDefault();
}
}, true);This resolves the problem without interfering with the original Cancel functionality.
Suggested fix: Call `event.preventDefault()` in the extension's existing Cancel click handler, so canceling an edit does not affect the page's scroll position.
2. Missing localization support in the emoji picker
Although the main JLex Comment interface can be translated using Joomla language files, some strings in the emoji picker remain in English.
In particular:
- Emoji category names such as "People", "Nature", "Foods", "Activity", "Objects", and "Symbols".
- The "Search" placeholder in the emoji search input.
- Potentially other interface messages such as "Loading..." and "No results".
<p class="EmojiPanel__category" id="people">People</p>This makes it possible to translate them dynamically without changing the underlying emoji data.
My workaround: I added JavaScript that checks the page language (`document.documentElement.lang`), replaces category labels according to their IDs, and changes the search placeholder to "Vyhledat…" when the language is Czech.
Because the emoji picker updates its content dynamically, I use a `MutationObserver` to reapply translations when necessary.
Suggested improvement: Allow emoji picker interface strings to be localized through Joomla language constants, or provide a localization object when initializing the emoji picker.
For example, the picker could accept translations for category names, the search placeholder, loading messages, and empty search results.
This would make it much easier to provide a fully localized commenting interface without additional JavaScript modifications.
Conclusion
Both workarounds are functioning correctly in my installation. Neither requires changes to the core JLex Comment files.
I hope these findings will be useful for a future release. Thank you for your continued work on JLex Comment!
Best regards