mkdocs-material icon indicating copy to clipboard operation
mkdocs-material copied to clipboard

Feedback form only appears after page refresh

Open LordOfPolls opened this issue 3 years ago • 2 comments

Contribution guidelines

I've found a bug and checked that ...

  • [X] ... the problem doesn't occur with the mkdocs or readthedocs themes
  • [ ] ... the problem persists when all overrides are removed, i.e. custom_dir, extra_javascript and extra_css
  • [X] ... the documentation does not mention anything about my problem
  • [X] ... there are no open or closed issues that are related to my problem

Description

When using the feedback form, and cookie consent; the "was this page helpful" prompt only appears after a page refresh.

Expected behaviour

After accepting cookies, the feedback prompt should be visible without a refresh

Actual behaviour

-User accepts cookies -Feedback prompt is not shown -User refreshes page -Feedback prompt is shown

Steps to reproduce

-Enable cookie consent -Enable feedback form, adding js to extra_javascript folder as per docs

Package versions

  • Python: 3.10.4
  • MkDocs: 1.3.1
  • Material: 8.3.9+insiders.4.21.0

Configuration

extra:
  analytics:
    provider: google
    property: G-817ZC2FC56
    feedback:
      title: Was this page helpful?
      ratings:
        - icon: material/heart
          name: This page was helpful
          data: 1
          note: >-
            Thanks for your feedback!
        - icon: material/heart-broken
          name: This page could be improved
          data: 0
          note: >-
            Thanks for your feedback! Please create an <a href="https://github.com/NAFTeam/NAFF/issues/new/choose">issue on Github</a> if you have any suggestions.
  consent:
    title: Cookie consent
    description: >-
      We use cookies to measure the effectiveness of our documentation and whether users
      find what they're searching for. With your consent, you're helping us to
      make our documentation better.
    actions:
      - accept
      - reject


extra_javascript:
  - scripts/feedback.js

System information

  • Operating system: Windows and Android
  • Browser: Firefox and Chrome -- both clean installs

LordOfPolls avatar Aug 06 '22 06:08 LordOfPolls

Thanks for reporting. You have customizations in place:

extra_javascript:
  - scripts/feedback.js

Please remove them and check whether the issue persists.

squidfunk avatar Aug 06 '22 12:08 squidfunk

My bad, I got it in my head I needed those lines. Regardless, with or without the behaviour is the same.

Live config file: https://github.com/NAFTeam/NAFF/blob/docs-refresh/mkdocs.yml URL showing the issue: https://naff.info/Guides/01%20Getting%20Started.html

LordOfPolls avatar Aug 06 '22 14:08 LordOfPolls

Thanks! I'm not able to reproduce this issue. The moment I accept the cookie consent, the page automatically reloads, and the feedback widget is rendered:

https://user-images.githubusercontent.com/932156/184474507-a9581925-62d0-496c-936e-00031a68d66e.mp4

I've used the following (simple) configuration as copied from our documentation:

extra:
  consent:
    title: Cookie consent
    description: >-
      We use cookies to recognize your repeated visits and preferences, as well
      as to measure the effectiveness of our documentation and whether users
      find what they're searching for. With your consent, you're helping us to
      make our documentation better.
  analytics:
    provider: google
    property: UA-12345 # !ENV GOOGLE_ANALYTICS_KEY
    feedback:
      title: Was this page helpful?
      ratings:
        - icon: material/emoticon-happy-outline
          name: This page was helpful
          data: 1
          note: >-
            Thanks for your feedback!
        - icon: material/emoticon-sad-outline
          name: This page could be improved
          data: 0
          note: >-
            Thanks for your feedback! Help us improve this page by
            using our <a href="..." target=_blank>feedback form</a>.

Closing as not reproducible. If you manage to provide a reproduction, please reopen.

squidfunk avatar Aug 13 '22 07:08 squidfunk