Skip to content

Commit

Permalink
Merge branch 'fix/expand-validation-error' into 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
danharrin committed Dec 13, 2023
2 parents d3ea0d5 + 7ca4c57 commit 81077f5
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/forms/resources/views/component-container.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<x-filament::grid
:x-data="$isRoot ? '{}' : null"
:x-on:expand-concealing-component.window="
:x-on:form-validation-error.window="
$isRoot ? ('
if ($event.detail.livewireId !== ' . Js::from($this->getId()) . ') {
return
Expand All @@ -30,7 +30,7 @@
setTimeout(
() =>
error.scrollIntoView({
error.closest(\'[data-field-wrapper]\').scrollIntoView({
behavior: \'smooth\',
block: \'start\',
inline: \'start\',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
$hasError = filled($statePath) && ($errors->has($statePath) || ($hasNestedRecursiveValidationRules && $errors->has("{$statePath}.*")));
@endphp

<div {{ $attributes->class(['fi-fo-field-wrp']) }}>
<div data-field-wrapper {{ $attributes->class(['fi-fo-field-wrp']) }}>
@if ($label && $labelSrOnly)
<label for="{{ $id }}" class="sr-only">
{{ $label }}
Expand Down
4 changes: 2 additions & 2 deletions packages/forms/src/Concerns/InteractsWithForms.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public function validate($rules = null, $messages = [], $attributes = []): array
} catch (ValidationException $exception) {
$this->onValidationError($exception);

$this->dispatch('expand-concealing-component', livewireId: $this->getId());
$this->dispatch('form-validation-error', livewireId: $this->getId());

throw $exception;
}
Expand All @@ -193,7 +193,7 @@ public function validateOnly($field, $rules = null, $messages = [], $attributes
} catch (ValidationException $exception) {
$this->onValidationError($exception);

$this->dispatch('expand-concealing-component', livewireId: $this->getId());
$this->dispatch('form-validation-error', livewireId: $this->getId());

throw $exception;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/panels/dist/theme.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/panels/resources/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}

/* When scrolling to validation error, do not hide element behind the top bar */
[data-validation-error] {
scroll-margin-top: 10rem;
[data-field-wrapper] {
scroll-margin-top: 8rem;
}
}

0 comments on commit 81077f5

Please sign in to comment.