Skip to content

Inconsistent styles inheritance in NcAvatar #3877

@Antreesy

Description

@Antreesy

Here are some research results:

  • Avatar comes as image from server. Its color is defined by method avatarUrlGenerator() in NcAvatar.vue
    Related PR: https://github.com/nextcloud/nextcloud-vue/pull/3119/files
  • method avatarUrlGenerator() is called with method loadAvatarUrl(), which is called in mounted hook, but returns different result from the second attempt
  • parameter --background-invert-if-dark: invert(100%) is defined by app theme (dark.css) and remains the same in process

So the conclusion is, result of window.getComputedStyle() call is inconsistent due to different browsers and security reasons
Changing the attribute from this.$el to document.body in this place works, because body and its style aren't changing, unlike the unmounted and mounted again avatar.

Originally posted by @Antreesy in nextcloud/spreed#8625 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions