-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#579: Nieuwe release maken Cookie Consent module #39
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for preparing the release, Nick!
I feel like there are a couple small things to look into before we take this out of beta.
Please let me know if any comments are unclear or if you want to look into something together.
README.md
Outdated
|
||
window.CookieConsent = cookieConsent; | ||
export const DEFAULTS = { | ||
type: "checkbox", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here "type: checkbox" is still listed.
If we don't support otherwise, I would remove this option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has now been removed
README.md
Outdated
el.addEventListener('click', e => { | ||
e.preventDefault(); | ||
cookieConsent.hideDialog(); | ||
el.addEventListener("click", (e) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the previous example you use button.addEventListener
, I would do so here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been changed to button.addEventListener
README.md
Outdated
/** | ||
* Header | ||
*/ | ||
wookie-consent::part(cookie-consent__header) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😂 Wookie-consent!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha oops, this has been adjusted to cookie-consent
}); | ||
``` | ||
|
||
### isAccepted(id: string) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happened to all methods that have been removed from the README?
They all sound very useful. If they are gone, I would like to make some GH issues to remind us to re-implement them.
(talking about isAccepted
, getPreferences
, on
, and updatePreferences
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I can see in dialog.mjs
the methods are still available, so I would like to return the documentation on them as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah, I didn't see. Everything has been re-added except for isAccepted
this method is not being used anymore as this can be easily checked in the frontend right now after cookies have been updated.
src/dialog.mjs
Outdated
// sets and returns 'this.shadowRoot' | ||
this.attachShadow({ mode: "open" }); | ||
// get data | ||
this.data = this.getData(); | ||
// get config | ||
this.config = this.getConfig(); | ||
// initialize event dispatcher | ||
this.events = this.initEventDispatcher(); | ||
// initialize teblist | ||
this.tabList = this.initTabList(); | ||
// get cookies | ||
this.cookies = this.data.cookies; | ||
// generate dialog element | ||
this.dialogElement = this.generateDialogElement(); | ||
// append dialog to shadowRoot | ||
this.shadowRoot.append(this.dialogElement); | ||
// get preferences | ||
this.preferences = this.getPreferences(); | ||
// initialize domtoggler | ||
this.domToggler = this.initDomToggler(); | ||
// initialize show and hide | ||
this.show = this.show(); | ||
this.hide = this.hide(); | ||
// get all preferences | ||
this.preferences.getAll(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the comments add a lot of value here, they're nearly copies of the actual lines of code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would you suggest, should they be removed or rephrased? 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think they can be safely removed!
src/dialog.mjs
Outdated
|
||
// Radio when no option is selected. | ||
if (TYPE === 'radio' && !values.find(v => v.accepted)) { | ||
if (this.config.type === "radio" && !values.find((v) => v.accepted)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are also still references to radiobuttons.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now gone
test/cookie-consent.test.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to leave this test intact.
It's a really simple test, feels doable to reproduce it for the new module version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test is now rewritten to work with the custom element
src/dialog.mjs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we rename this to CookieConsent
? (cookie-consent.mjs
)
It makes sense to me that the "main" element in this module is called "cookie consent" and not "dialog". It feels more intuitive to the developers working on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 🙂
Oh, and regarding the checkboxes versus radiobuttons: can you elaborate on why the radiobuttons are no longer supported? If we don't use them in client projects it's fine to move ahead with this, but let's in any case make an issue here on GitHub to keep track of the status of that feature. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@harmenjanssen is zo te zien al bezig geweest! Ik heb ook nog paar kleine comments.
README.md
Outdated
- When showing, the module will remove any inline set `display` style, along with any `hidden` or `aria-hidden` attributes. | ||
|
||
## Options | ||
Once registered, you can add the cookie-consent element to your HTML, you can pass custom data attributes for the: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deze zin loopt niet helemaal lekker! Misschien kan je het beter veranderen in:
Once registered, you can add the cookie-consent element to your HTML, you can pass custom data attributes for the: | |
Once registered, you can add the cookie-consent element to your HTML and pass custom data attributes for the following: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah thanks! Dit is aangepast
- title | ||
- description | ||
- save button text | ||
- cookie types | ||
|
||
```js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dit loopt nog niet helemaal lekker in elkaar over. De data attributes worden benoemd, maar dit wordt pas verder uitgelegd onder het kopje Options
. Misschien kan dit allemaal verplaatst worden on het kopje Options
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ook dit is nu wat aangepast
The radio buttons are no longer supported because the |
But are there always required cookies? In the past this could be used with all-optional cookies I think. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, Nick, thanks for the updates!
This is starting to look good.
Can you look into the failing CI processes?
I would prefer to have a little more tests, just to have some affordance that this update does indeed keep existing functionality intact, but since there were so little to begin with, we can get away with moving them to the backlog and work on them in retrospect.
But for instance, a check that the public methods still work would be very nice to have.
To be fair I don't really know, what I do know is that it's legal to always have functional cookies on. But then again I don't really know whether or not they're always necessary. |
@harmenjanssen all CI processes are now succeeding except for the slack notification is this something that needs to be fixed as well? |
@harmenjanssen the slack notification is now also succeeding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
34785e1
to
86dc5a3
Compare
Add config functions Update code Add data attributes Update code Update custom events Update template Remove redundant code Fix show and hide dialog functionality Remove old code Revert to .mjs Update formatting Update imports Update import Remove @types/react Update dialog Update dialog Update tablist Add parameters to function Remove redundant file Fix linter error Update test Update checked state Remove whitespaces Update yarn lock Fix linting errors Remove failing test Remove aria-description 1.2.1-beta.1 Update cookie-consent to custom element Add config functions Update code Add data attributes Update code Update custom events Update template Remove redundant code Fix show and hide dialog functionality Remove old code Revert to .mjs Update formatting Update imports Update import Remove @types/react Update dialog Update dialog Update tablist Add parameters to function Remove redundant file Fix linter error Update test Update checked state Remove whitespaces Update yarn lock Fix linting errors Remove failing test Remove aria-description Hide cookie consent in print media styles Remove idea files Remove idea files Remove idea workspace file Update dialog generateDialogElement method Update imports with file extension Update package version grrr utils Updated defaultbuttonLabel to defaultButtonLabel Update README Update README Update README Update button label Update stylesheet Update readme Update code Update readme Update string quotes Re-add test Format code Update slack notification Format code Update version Format files
7e61f25
to
403bd7c
Compare
::part
's I've updated the default stylesheet to now use those.