Dropdown (Select tag, Combobox) not working in GeckoView implementation

不想你离开。 提交于 2021-01-27 19:35:44

问题


I'm implementing a Geckoview instance inside an android App. Everything looks to work properly and the Geckoview is able to load a URL. My problem is that if a site has a dropdown (select tag, Combobox) when I click in the arrow the options don't appear.

I've tried using different versions and channels of the repositories (nightly, release, beta), and I'm still having the same problem.

I've tried in different devices and versions of android.

When I use browser that use Geckoview (Reference Browser, Firefox Preview) the "dropdowns" work perfectly, so i asume that is a configuration problem in the my implementation of the Geckoview.

GeckoView geckoview;
GeckoSession session;
GeckoRuntime runtime;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    geckoview = findViewById(R.id.geckoviewer);
    session = new GeckoSession();

    session.getSettings().setAllowJavascript(true);
    session.getSettings().setDisplayMode(GeckoSessionSettings.DISPLAY_MODE_FULLSCREEN);
    session.getSettings().setUserAgentMode(GeckoSessionSettings.USER_AGENT_MODE_MOBILE);

    GeckoRuntimeSettings.Builder builder = new GeckoRuntimeSettings.Builder()
            .javaScriptEnabled(true)

            .consoleOutput(true);

    runtime = GeckoRuntime.create(this, builder.build());

    session.open(runtime);

回答1:


The reason for that is that GeckoView does not provide a default implementation for that. You need to implement PromptDelegate (and in this case onChoicePrompt()).

See API docs: https://mozilla.github.io/geckoview/javadoc/mozilla-central/org/mozilla/geckoview/GeckoSession.PromptDelegate.html

Reference Browser and Firefox Preview are using the implementation from Mozilla's "Android Components' project. The feature-prompts component implements all those prompts: https://github.com/mozilla-mobile/android-components/tree/master/components/feature/prompts

Another implementation is used by the "GeckoView Example app" and you can find that code here: https://searchfox.org/mozilla-central/source/mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/BasicGeckoViewPrompt.java



来源:https://stackoverflow.com/questions/58670925/dropdown-select-tag-combobox-not-working-in-geckoview-implementation

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!