This app can automatically detect user/pass form in website in chrome and autofill them, using accessibility service. https://helpdesk.lastpass.com/lastpass-mobile/lastpass-for-android/
According to this comment, they do that by executing javascript on the page. Personally I don't find any injected javascript, nor event listener on those field.
I wonder how this was done? All I can find is how to do this in WebView.