Giter VIP home page Giter VIP logo

feedbackfin's Introduction

Feedback Fin

A tiny widget to collect feedback anywhere on your website. That’s it.

WebsiteDiscordTwitter

npm version Package size

Demo GIF

Try the widget ↗

Quick Start

  1. Load the widget on your page:

    <script src="https://unpkg.com/feedbackfin@^1" defer></script>
  2. Setup a webhook URL (read instructions in the next section) and configure that in the script. Optionally, add any user info that you want to pass in from the website:

    <script>
      window.feedbackfin = { config: {}, ...window.feedbackfin };
      window.feedbackfin.config.url = "https://rowy-hooks.run.app/wh/...";
      window.feedbackfin.config.user = { name: "...", email: "..." };
    </script>
  3. Set a button to open the widget:

    <button data-feedbackfin-button>Feedback</button>

Setting up a webhook URL

This is the URL to send the feedback to. The widget will make a POST request to this URL with the feedback data as a JSON body.

Generate a webhook URL easily using Rowy's low-code platform and manage feedback data on a collaborative spreadsheet-UI. Optionally, you can further automate on incoming feedback with Rowy's built-in code-editor (eg: notify on team slack/discord, email follow up etc).

End-to-end video instructions on the website ↗

Options

Options are set in the window.feedbackfin.config object:

url

The URL to send the feedback to. The widget will make a POST request to this URL with the data as a JSON body. See Setting up a webhook URL above.

user

An object whose contents will be submitted as part of the form. Note: feedbackType, message, and timestamp are reserved fields and will be overwritten by form values.

Typically:

window.feedbackfin.config.user = {
  name: "...",
  email: "...",
};

disableErrorAlert

Optionally, disables displaying alerts if no URL is set or the request fails. Default: disableErrorAlert: false

How it works

When the script is loaded, it looks for any elements with the data-feedbackfin-button attribute and opens the widget when any of those elements are clicked.

<button data-feedbackfin-button>Feedback</button>

The window.feedbackfin object exposes the open, close, and submit methods, so they can also be called directly.

<button onclick="window.feedbackfin.open(event)">Feedback</button>

The widget uses event.target to compute its position using Floating UI.

Customization

The widget is attached just before the closing </body> tag when it is open and respects your page’s font-family. Styles are attached just before the opening <head> tag so your customizations take precedence.

You can customize the widget’s appearance by:

  • Overriding the CSS variables.

    For example, you can change the primary button color using:

    :root {
      --feedbackfin-primary-color: #007aff;
      --feedbackfin-primary-color-text: #fff;
    }
  • Overriding the CSS rules. Class names are prefixed with feedbackfin__.

Dark mode

Dark mode is activated when either:

  • the user sets their system theme to dark
    i.e. @media (prefers-color-scheme: dark) is true, or

  • any parent element has a data-theme attribute whose value contains dark.
    Example: <body data-theme="dark">

Dark mode colors are set using CSS variables. You can override them with:

@media (prefers-color-scheme: dark) {
  :root {
    ...;
  }
}

[data-theme*="dark"] {
  ...;
}

Accessibility

This widget is built using standard HTML form elements with the appropriate labels.

Focus is trapped within the widget when it is open using focus-trap. Be careful when nesting this widget inside another element with a focus trap.

Contributing

Contribute to Feedback Fin with issues and pull requests in the GitHub repo.

Support

feedbackfin's People

Contributors

harinij avatar notsidney avatar shamsmosowi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

feedbackfin's Issues

Support other webhooks

Failed to setup Rowy so I tried webhook.site instead. Now, when I send feedback, it fails. A request is made to the webhook, but with no data.

image

image

Feedbackfin in React App

I want to add this to my react application and when I add it to the index.html everything works but I only want this to be visible on some pages so I created a component including the scripts and button but using this method, nothing happens when I click on the "feedback" button.

Is there a way to fix this?

Have a modal type behavior as well

I found this interesting. It is very simple and intuitive to use.
However, I would love to have a modal-type behavior for this.

So basically, as soon the feedback is triggered, there should be an option to show the feedback form widget as modal. that means it should be aligned with respect to screen width and height. and the whole background should turn dark.

Clicking outside the popup should close it once feedback has been submitted or before a type has been picked.

It's common for dialog boxes like this to allow you to dismiss them by clicking anywhere outside the dialog box. In this case, I think we'd want that except if the user is in the midst of entering text (because then they might lose their text).

Definitely once the feedback has been submitted there's no reason to make the user close the window manually.

Another option would be to have the window fade out after a short timeout after submission.

Captcha Support?

Captcha (Recaptcha? HCaptcha?) support would've been very nice.

Obviously the captcha would need to be confirmed by the person's backend once received from the webhook (however that isn't difficult), all that would be required is that the feedback form widget itself supports it.

JavaScript error thrown: "Uncaught TypeError: Cannot read properties of null (reading 'addEventListener')"

It happens on this line:

        document.getElementById("feedbackfin__form").addEventListener("submit", Ge),
---> document.getElementById("feedbackfin__back").addEventListener("click", pe)

This doesn't seem to stop it from working, but it would be nice to get rid of the console noise. Also, this has caused some problems for us because we have a global handler registered for errors and filtering this out in a cross-browser way is annoying.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.