Skip to content

Different css behaviour when baseUrl is null #386

@ivstiv

Description

@ivstiv

Bug Report

I think due to the following ternary people who want to have highlighting and LCP would run into problems with text selection.

server = if (baseUrl != null) null
else WebViewServer(
application, publication,
servedAssets = config.servedAssets,
disableSelectionWhenProtected = config.disableSelectionWhenProtected

So far from my experience when trying to use the EpubNavigatorFragment I get different behaviour for the disableSelectionWhenProtected in the config when passing/not passing baseUrl.

childFragmentManager.fragmentFactory =
            EpubNavigatorFragment.createFactory(
                publication = publication,
                baseUrl = baseUrl,
                initialLocator = model.initialLocation,
                listener = this,
                config = EpubNavigatorFragment.Configuration().apply {
                    selectionActionModeCallback = customSelectionActionModeCallback
                    disableSelectionWhenProtected = false
                }
            )

When baseUrl is passed in the publication doesn't use the escape hatch introduced by this PR because it only exists in the WebViewServer. I don't understand how does it work with the server being null but if I remove the baseUrl to force the other side of the branching logic and use the instance of the WebViewServer, the escape hatch for disableSelectionWhenProtected starts working but the background colour and potentially some other css settings are not being set.

So I effectively need to choose between being able to select text or have the correct preferences set from the get go. A later change in the settings is reflected correctly and does update the UI.

Is this really a bug or am I misusing the fragment somehow?

What happened?

Expected behavior

How to reproduce?

Environment

  • Readium version:

Development environment

  • OS:
  • IDE:

Testing device

  • Android version:
  • Model:
  • Is it an emulator? Yes or No

Additional context

  • Are you willing to fix the problem and contribute a pull request? Yes or No

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions