Skip to content

Commit a915a64

Browse files
committed
Added the ability for a fully-accessible, page blocking modal
1 parent 4dd0be8 commit a915a64

File tree

13 files changed

+428
-402
lines changed

13 files changed

+428
-402
lines changed

CHANGELOG.md

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,40 @@ All notable changes to `laravel-cookie-guard` will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8+
## v4.1.0 - Improved Accessibility & Bug Fixes - 2025-04-03
9+
10+
We have decided to give the developers the ability to use the pure `<dialog>` HTML element functionality for our cookie
11+
consent component to enhance accessibility and ensure compliance with privacy regulations.
12+
13+
The `<dialog>` element is designed to create a modal dialog that captures the user's focus, preventing interaction with
14+
the rest of the webpage
15+
until the dialog is dismissed.
16+
This approach ensures that users must make a choice regarding cookie consent before they
17+
can continue using the website.
18+
19+
By using the `<dialog>` element, we achieve the following benefits:
20+
21+
1. **Improved Accessibility:** The `<dialog>` element is natively supported by modern browsers and provides built-in
22+
accessibility features. It ensures that screen readers and other assistive technologies can properly announce the
23+
dialog and its contents to users with disabilities.
24+
25+
26+
2. **Focus Management:** When the dialog is open, it automatically captures the focus, preventing users from navigating
27+
outside of it. This ensures that users cannot interact with other parts of the website until they have accepted or
28+
rejected the cookies, making the consent process clear and unavoidable.
29+
30+
31+
3. **Compliance with Privacy Regulations:** By requiring users to make a choice before continuing to use the website, we
32+
ensure compliance with privacy regulations such as the GDPR. This approach guarantees that users are informed about
33+
and consent to the use of cookies before any data is collected.
34+
35+
Overall, the use of the `<dialog>` element enhances the user experience by providing a clear and accessible way to
36+
manage cookie consent, ensuring that all users can interact with our website in a compliant and user-friendly manner.
37+
38+
This functionality is now the **default behavior of the plugin**, and it can be disabled by setting the new
39+
`use_floating_modal`
40+
flag in the `config/cookies_consent.php` file to `true`.
41+
842
## v4.0.0 - Multilingual Support & Better Theming - Breaking Changes in Configuration and Functionality - 2025-03-07
943

1044
The plugin is now renamed to `laravel-cookie-guard` and has undergone some major updates! 🎉🥳😍
@@ -22,19 +56,22 @@ composer require scify/laravel-cookie-guard
2256
php artisan vendor:publish --provider="SciFY\LaravelCookiesConsent\LaravelCookiesConsentServiceProvider" --tag="cookies-consent-public" --force
2357
```
2458

25-
Then, make sure to check the configuration file `config/cookies_consent.php` and update it according to [the new one](config/cookies_consent.php).
59+
Then, make sure to check the configuration file `config/cookies_consent.php` and update it according
60+
to [the new one](config/cookies_consent.php).
2661

2762
Then, make sure that the Laravel components you use are the new ones:
2863

2964
Intead of using:
3065

3166
```html
67+
3268
<x-laravel-cookies-consent></x-laravel-cookies-consent>
3369
```
3470

3571
Use:
3672

3773
```html
74+
3875
<x-laravel-cookie-guard-scripts></x-laravel-cookie-guard-scripts>
3976
<x-laravel-cookie-guard></x-laravel-cookie-guard>
4077
```
@@ -77,13 +114,13 @@ If you want to override the CSS styles of the cookies consent dialog, you can do
77114

78115
<x-laravel-cookie-guard></x-laravel-cookie-guard>
79116
<style>
80-
#scify-cookies-consent {
81-
--scify-cookies-primary-color: #ff5722; /* Override primary color */
117+
#scify-cookies-consent {
118+
--scify-cookies-primary-color: #ff5722; /* Override primary color */
82119
83-
...
120+
...
84121
85-
/* Add more override rules here */
86-
}
122+
/* Add more override rules here */
123+
}
87124
</style>
88125
```
89126

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<!-- omit in toc -->
2+
23
# Laravel Cookie Guard - Make your Laravel app compliant with the EU GDPR cookie law
34

45
The **last** Cookies Consent Plugin your **Laravel app** will ever need!
@@ -22,6 +23,7 @@ The **last** Cookies Consent Plugin your **Laravel app** will ever need!
2223
[![GitHub closed pull-requests](https://img.shields.io/github/issues-pr-closed/scify/laravel-cookie-guard)](https://github.com/scify/laravel-cookie-guard/pulls?q=is%3Apr+is%3Aclosed)
2324

2425
<!-- omit in toc -->
26+
2527
## Table of Contents
2628

2729
- [Upgrading to v4](#upgrading-to-v4)
@@ -192,6 +194,7 @@ return [
192194
'hide_floating_button_on_mobile' => false, // Set to true to hide the floating button on mobile
193195
'use_separate_page' => false, // Set to true to use a separate page for cookies explanation
194196
'categories_collapsed_by_default' => true, // Set to false to initially collapse the optional categories
197+
'use_show_modal' => true, // Set to false to disable the use of showModal() on the dialog HTML element
195198
/*
196199
|--------------------------------------------------------------------------
197200
| Editor
@@ -271,6 +274,9 @@ The `categories_collapsed_by_default` field is optional and, if set to `false`,
271274
categories.
272275
If set to `true`, all categories will be collapsed by default.
273276
277+
The `use_floating_modal` field is optional and, if set to `true`, will disable the use of `showModal()` on the dialog HTML,
278+
and the fully-accessible modal.
279+
274280
You can add as many cookie categories as you like, simply by adding values to the `cookies` array.
275281
276282
If you want to remove a cookie category, simply remove it from the array.
@@ -651,8 +657,7 @@ Or, to prune everything and re-install:
651657
rm -rf public/vendor/scify && \
652658
rm -rf vendor/scify && \
653659
composer require scify/laravel-cookie-guard && \
654-
php artisan vendor:publish --provider="SciFY\LaravelCookiesConsent\LaravelCookiesConsentServiceProvider" --tag="cookies-consent-public" --force && \
655-
php artisan config:cache
660+
php artisan vendor:publish --provider="SciFY\LaravelCookiesConsent\LaravelCookiesConsentServiceProvider" --tag="cookies-consent-public" --force
656661
```
657662
658663
### Testing

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@
2323
"php": "^8"
2424
},
2525
"require-dev": {
26-
"larastan/larastan": "^3.1",
27-
"laravel/pint": "^1.6",
28-
"nunomaduro/collision": "^8.0",
26+
"larastan/larastan": "^3.2",
27+
"laravel/pint": "^1.21",
28+
"nunomaduro/collision": "^8.7",
2929
"orchestra/testbench": "^10.0",
30-
"pestphp/pest": "^3.7",
30+
"pestphp/pest": "^3.8",
3131
"pestphp/pest-plugin-laravel": "^v3.1",
3232
"phpstan/extension-installer": "^1.1",
3333
"phpstan/phpstan-deprecation-rules": "^2.0",
3434
"phpstan/phpstan-phpunit": "^2.0",
3535
"phpunit/phpunit": "^11.5",
36-
"spatie/laravel-ray": "^1.39"
36+
"spatie/laravel-ray": "^1.40"
3737
},
3838
"autoload": {
3939
"psr-4": {

0 commit comments

Comments
 (0)