Fixed by direct check if the call is media_library_opener and give it admin theme, this is might be temporary solution only.
Issue exists in core varbase
ajax_page_state[theme]: vartheme_bs5
IbrahimTameme → created an issue.
I applied #138 patch and it worked but there was an issue with unrecognized setAttribute function inside an event handler that casued an error and max length not working, setAttribute is a method that only works on individual DOM elements, not on jQuery objects or collections of elements.
To fix this, I modified the event handler to iterate over each element in field using .each(), allowing us to correctly call setAttribute on each raw DOM element individually.
This patch solves the issue.